-
Notifications
You must be signed in to change notification settings - Fork 733
[CI] pre-commit: run maven-spotless-apply
and oxipng
manually
#2197
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
base: master
Are you sure you want to change the base?
Conversation
The "manual" stage in pre-commit refers to a specific hook stage designed for hooks that are not intended to run automatically during a standard git commit operation. Instead, these hooks are meant to be triggered explicitly by a user, typically when performing a full repository scan or a specific check. This speeds up the standard `pre-commit run --all-files` run by not running these two hooks. Both hooks are time consuming Can run the manual hooks with: `pre-commit run --all-files --hook-stage manual`
The pre-commit run here only took about 2 minutes. On other previous PRs it takes about 5 minutes |
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 removes the automatic quality gates for code formatting, image optimization during a standard commit. This can lead to inconsistencies and quality issues being introduced into the codebase if developers forget to run the manual hooks.
Recommendation:
To ensure these checks are still performed, please consider adding a CI step that runs the manual hooks on every pull request. This would look something like:
- name: Run manual pre-commit hooks
run: pre-commit run --all-files --hook-stage manual
This approach balances developer convenience with repository quality.
I still think maven spotless apply should run automatically, just that ideally we don't run it unnecessarily (e.g during python development). Why don't we just remove this part? always_run:
true # Ensures this hook runs even if no Java files are changed.
# This is useful for spotless:apply which might affect files not staged. If we remove it, won't pre-commit still run whenever changes to java/scala files are committed? That's really the only time it matters right IMO. Or am I missing something? I don't fully understand the intention of the comment. |
I tried your suggestion against the master branch and it didn't seem to work. I get:
If it worked it would not fail and would print for the spotless check And I did try messy Java files and staged them and had the same result that hook did not apply. See below for my workflow.
|
The "manual" stage in pre-commit refers to a specific hook stage designed for hooks that are not intended to run automatically during a standard git commit operation. Instead, these hooks are meant to be triggered explicitly by a user, typically when performing a full repository scan or a specific check.
This speeds up the standard
pre-commit run --all-files
run by not running these two hooks.Both hooks are time consuming
Can run the manual hooks with:
pre-commit run --all-files --hook-stage manual
Did you read the Contributor Guide?
Is this PR related to a ticket?
[CI] my subject
What changes were proposed in this PR?
As described above.
How was this patch tested?
Ran pre-commit both normally and manually.
Did this PR include necessary documentation updates?