-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Added pre-commit hooks #421
Conversation
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.
I rather wait 10s than manually run spotless & commit & squash & force-push & hate Spotless :p
* gradle installs the hook * hook executes spotless and unit tests
7b0ac36
to
2295b44
Compare
Kudos, SonarCloud Quality Gate passed! |
cant u get it to apply spotless with github actions? |
@borgrel That would be pretty messy. Since then someone else creates new commits on "your branch", which interfers with your local branch. I.e. you have to do Everyone and their mother uses pre-hooks for anything that actually changes code/commits for that reason. The pre-commit hook is the standard solution for this and it works perfectly fine (once someone actually figures out how to configure it and set it up - i.e. what I had to do here 😆). The fact that the change is applied to the commit before it is even created or pushed, simplifies things massively for everyone working with git. Git doesnt like it if u start manipulating commits, history starts getting incompatible then and the only solution out is force-push and throw-away-and-fresh-checkout. |
nods thanks for the explination |
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.
Since we decided to go with a pre-commit hook, we don't need a previous spotlessApply
on compile/build strategy.
That way, everyone can enjoy their own formatting, without getting annoyed with constant spotless re-formatting while they work.
If you agree, you can remove this line:
Line 58 in 3ea40dc
dependsOn 'spotlessApply' |
This pull request is stale because it has been open 30 days with no activity. Remove stale label, comment or add the valid label or this will be closed in 5 days. |
since we now have the pre commit hook
Kudos, SonarCloud Quality Gate passed! |
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.
Looks good. Thanks for documenting it nicely.
Consider this PR approved even if you force push some history cleanup.
Overview
This adds a pre-commit hook with an automatic installation to get rid of
commits 😆
Gradle installs the hook and the hook applies spotless
and runs the unit tests.Downside, commits now take about
10 seconds2 seconds.