-
Notifications
You must be signed in to change notification settings - Fork 162
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 check_phase
to pre-commit settings
#415
base: master
Are you sure you want to change the base?
Conversation
@joedevivo, if I understand correctly, the issue you were having was that, after setting As far as the feature itself goes, the |
Added the mentioned test cases to the new test suite https://github.com/cachix/git-hooks.nix/pull/423/files#diff-6c8d597050bd88f356507ec90b216be2fcd69fce6e488c62060f12bae96deddeR37-R51 Indeed my PR appears to fix the mentioned issue already. Let me know if I misunderstood anything. |
@@ -263,6 +263,16 @@ in | |||
default = [ "commit" ]; | |||
}; | |||
|
|||
check_stage = | |||
mkOption { | |||
type = types.str; |
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 could be the enum part of supportedHooksLib.supportedHooksType
'' | ||
This is pre-commit stage to be used in a nix `checkPhase`. `commit` maps to `pre-commit`, which is `pre-commit`'s default. | ||
''; | ||
default = "commit"; |
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.
We could set this to the first of default_stages
and fallback to pre-commit
The existing behavior of
pre-commit-hooks.nix
is to use thepre-commit
phase of pre-commit hooks, unless yourdefault_phases = [ "manual" ]
. On further inspection I found that it has to be onlymanual
. Ifdefault_phases = [ "manual" "push" ]
, it will usecommit
. In my particular case, I wanteddefault_phases = [ "push" ]
, which then rancommit
hooks when I rannix flake check
.This PR adds
check_phase
to the configuration. Settingcheck_phase = "push"
runs thepre-push
phase checks when I runnix flake check
no matter what mydefault_phases
are.