-
-
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
Add 'may-spotless-apply' profile #1017
Conversation
I often find myself forgetting to apply spotless before committing. On some repositories, I have set up a pre-commit git hook running `mvn spotless:check`. However, this has to be set up on each repository that has spotless check enabled, and disabled on those which don't. I think this goes one step further, by defining a conventional maven profile `may-spotless-apply` that will run `spotless:apply` *only* if spotless is enabled for the given repository. This allows any user to incorporate `-Pmay-spotless-apply` as part of their usual build command (or defined in their maven settings active profiles section), and have `spotless:apply` automatically called if the project has it enabled.
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.
defined in their maven settings active profiles section
What would this look like? If you just set
<profile>
<id>may-spotless-apply</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
(with no further configuration in ~/.m2/settings.xml
) does that in fact cause the config in this parent POM to be run?
</goals> | ||
<phase>validate</phase> | ||
<configuration> | ||
<skip>${spotless.check.skip}</skip> |
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.
Lines 126 to 127 in 64885a6
<!-- Set to false to enable Spotless --> | |
<spotless.check.skip>true</spotless.check.skip> |
In fact, Maven
|
Worth mentioning in https://github.com/jenkinsci/plugin-pom/blob/master/README.md#formatting I guess. |
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.
Can you document it please
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.
Thanks for the PR!
I often find myself forgetting to apply spotless before committing.
On some repositories, I have set up a pre-commit git hook running
mvn spotless:check
. However, this has to be set up on each repository that has spotless check enabled, and disabled on those which don't.I think this goes one step further, by defining a conventional maven profile
may-spotless-apply
that will runspotless:apply
only if spotless is enabled for the given repository.This allows any user to incorporate
-Pmay-spotless-apply
as part of their usual build command (or defined in their maven settings active profiles section), and havespotless:apply
automatically called if the project has it enabled.Example Maven
settings.xml
See also jenkinsci/pom#611
Testing done
Submitter checklist