-
-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable Spotless for automatic formatting #733
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timja
approved these changes
Apr 2, 2023
MarkEWaite
approved these changes
Apr 9, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me. Will allow me to remove the spotless configuration from plugins that I maintain.
Optional change for consideration on the spotless plugin version number.
jamietanna
approved these changes
Apr 9, 2023
Co-authored-by: Mark Waite <[email protected]>
This was referenced Apr 9, 2023
Closed
MarkEWaite
added a commit
to jenkinsci/cloud-stats-plugin
that referenced
this pull request
Apr 9, 2023
MarkEWaite
added a commit
to jenkinsci/elastic-axis-plugin
that referenced
this pull request
Apr 9, 2023
MarkEWaite
added a commit
to jenkinsci/embeddable-build-status-plugin
that referenced
this pull request
Apr 9, 2023
MarkEWaite
added a commit
to jenkinsci/implied-labels-plugin
that referenced
this pull request
Apr 9, 2023
MarkEWaite
added a commit
to jenkinsci/markdown-formatter-plugin
that referenced
this pull request
Apr 9, 2023
MarkEWaite
added a commit
to jenkinsci/nodelabelparameter-plugin
that referenced
this pull request
Apr 9, 2023
MarkEWaite
added a commit
to jenkinsci/platformlabeler-plugin
that referenced
this pull request
Apr 9, 2023
MarkEWaite
added a commit
to jenkinsci/pre-scm-buildstep-plugin
that referenced
this pull request
Apr 9, 2023
MarkEWaite
added a commit
to jenkinsci/schedule-build-plugin
that referenced
this pull request
Apr 9, 2023
MarkEWaite
added a commit
to jenkinsci/testng-plugin-plugin
that referenced
this pull request
Apr 9, 2023
MarkEWaite
added a commit
to jenkinsci/versioncolumn-plugin
that referenced
this pull request
Apr 9, 2023
MarkEWaite
added a commit
to MarkEWaite/authorize-project-plugin
that referenced
this pull request
Apr 10, 2023
This was referenced Apr 10, 2023
3 tasks
This was referenced Apr 15, 2023
MarkEWaite
added a commit
to MarkEWaite/pipeline-steps-doc-generator
that referenced
this pull request
Apr 25, 2023
MarkEWaite
added a commit
to MarkEWaite/pipeline-metadata-utils
that referenced
this pull request
Apr 26, 2023
MarkEWaite
added a commit
to MarkEWaite/groovy-postbuild-plugin
that referenced
this pull request
Dec 16, 2023
jenkinsci/plugin-pom#733 describes the benefits of automated source code formatting and how automated source code formatting is now provided by the Jenkins plugin POM.
Merged
5 tasks
MarkEWaite
added a commit
to jenkinsci/groovy-postbuild-plugin
that referenced
this pull request
Dec 16, 2023
jenkinsci/plugin-pom#733 describes the benefits of automated source code formatting and how automated source code formatting is now provided by the Jenkins plugin POM.
MarkEWaite
added a commit
to MarkEWaite/discard-old-build-plugin
that referenced
this pull request
Feb 3, 2025
https://github.com/jenkinsci/plugin-pom?tab=readme-ov-file#formatting describes the use of spotless for formatting. jenkinsci/plugin-pom#733 discusses the benefits of automated formatting.
6 tasks
MarkEWaite
added a commit
to jenkinsci/discard-old-build-plugin
that referenced
this pull request
Feb 3, 2025
https://github.com/jenkinsci/plugin-pom?tab=readme-ov-file#formatting describes the use of spotless for formatting. jenkinsci/plugin-pom#733 discusses the benefits of automated formatting.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Supersedes #538. This PR enables Spotless for automatic formatting, on an opt-in basis through the presence of a
.mvn_exec_spotless
file, with the following two formatters:palantir-java-format
(4-space indentation, 120 column line length)I have tested this configuration in a dozen or so components and believe it to be the optimal path forward.
Anticipated Frequent Questions (AFQ)
Why do automatic formatting?
Why not do automatic formatting?
Why make this opt-in?
How do I adopt this?
touch .mvn_exec_spotless && git add .mvn_exec_spotless
.spotless-maven-plugin
configuration from yourpom.xml
file.mvn spotless:apply
.git commit -a
..git-blame-ignore-revs
file.(This will be published in the release notes.)
Why not allow the user to configure any of this?
Why make this opt-in via a file rather than a Maven property?
.mvn_exec_node
and.mvn_exec_yarn
profile activation files (which exist for the same reason).Why use 4-space indentation for Java files rather than 2-space indentation?
Why use 2-space indentation for Maven POM files rather than 4-space indentation?
Why use Spotless?
Why use
palantir-java-format
instead ofgoogle-java-format
?google-java-format
's 4-space AOSP mode results in unreadable code for lambdas.palantir-java-format
successfully.google-java-format
in AOSP mode compared topalantir-java-format
inplugin-compat-tester
showed that the latter was more readable.Why use Sortpom?
Why use Sortpom's POM element ordering feature?
Why sort dependencies, dependency management entries, and exclusions?
What if I want to use git blame after this?
.git-blame-ignore-revs
file as described in https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view.git blame -w
.