Skip to content
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 #611

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

Vlatombe
Copy link
Member

@Vlatombe Vlatombe commented Sep 23, 2024

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.

See also jenkinsci/plugin-pom#1017

Testing done

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

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.
@jglick
Copy link
Member

jglick commented Sep 23, 2024

(same question as in plugin-pom)

Copy link
Member

@basil basil left a 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!

@basil basil merged commit 61e475b into jenkinsci:master Sep 24, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants