-
Notifications
You must be signed in to change notification settings - Fork 173
feat: support specifying stages #52
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
Conversation
nice :D I think it's missing the option declaration. I haven't read the pre-commit docs so maybe it's not accurate, but perhaps You can test your change by using it in a project. We don't have a test suite yet. |
You can replace the |
Thanks! I broke things. 😢 nix-shell --show-trace
warning: unknown setting 'experimental-features'
unpacking 'https://github.com/blaggacao/pre-commit-hooks.nix/tarball/master'...
error: while evaluating the attribute 'lorriHook' of the derivation 'nix-shell' at /nix/store/isyka0a95cxhj1381bg3bbqdv78qrln9-nixpkgs-20.09pre235189.d7e20ee25ed/nixpkgs/pkgs/build-support/mkshell/default.nix:28:3:
while evaluating the attribute 'pre-commit-check.shellHook' at /home/blaggacao/ghq/git.p1.rocks/gitops/aedir-ldap.k8s/default.nix:6:3:
while evaluating anonymous function at /nix/store/b4jq885hsxy31h23f3b6c5dnizchgn5q-source/nix/run.nix:3:1, called from /home/blaggacao/ghq/git.p1.rocks/gitops/aedir-ldap.k8s/default.nix:6:22:
while evaluating the attribute 'config.pre-commit.run' at undefined position:
while evaluating anonymous function at /nix/store/ma3b77vjls3qrznwh66ix5ivvybx6003-source/lib/modules.nix:84:45, called from undefined position:
while evaluating 'yieldConfig' at /nix/store/ma3b77vjls3qrznwh66ix5ivvybx6003-source/lib/modules.nix:83:29, called from /nix/store/ma3b77vjls3qrznwh66ix5ivvybx6003-source/lib/modules.nix:86:16:
while evaluating anonymous function at /nix/store/ma3b77vjls3qrznwh66ix5ivvybx6003-source/lib/modules.nix:89:24, called from /nix/store/ma3b77vjls3qrznwh66ix5ivvybx6003-source/lib/modules.nix:89:11:
while evaluating anonymous function at /nix/store/ma3b77vjls3qrznwh66ix5ivvybx6003-source/lib/modules.nix:90:26, called from /nix/store/ma3b77vjls3qrznwh66ix5ivvybx6003-source/lib/modules.nix:90:13:
The option `pre-commit.default_stages' defined in `<unknown-file>' does not exist.
Yeay! I'm trying very hard to read between the line, yet this log doesn't talk to my brain.
|
Oh my link above is broken. You need to declare an option for |
cf5087d
to
dc6efb8
Compare
Example result
Easter egg: I don't think 'pull' actually exists. It's 'push' - I was trying to get in some entropy for |
Merge, 2, 3? 😉 Thank you @roberth for your guidance! |
Follow up to cachix#52
... now let's call it working! The code before the last commit only ever installed 'commit' stage. The code after the commit installs all known stages if they are configured or falls back to '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.
Just some simplifications around installation
@roberth I'd suggest for the intermediate term to adopt a work around with a more involved error catcher. Let's track pre-commit/pre-commit#1541 in complement to this course of action in a separate issue. Would that be in line with your concerns? |
36f7093
to
3fa3a17
Compare
We maybe, more fundamentally, have to ask ourselves, what stance to take on the pre-commit author's intentions:
Since in the current implementation On the other hand, shell.nix holds promises about repeatable development environments. EDIT: @domenkozar @roberth What do you think of out-factoring the install phase into another optional option, so we more faithfully maintain the opt-in + opt-out nature of pre-commit? - I don't have any better idea at the moment. |
Since the tool is called |
Fair enough 😄 In reality though, pre-commit is evolving into a repo-scoped (per-repo cache) packager for task runners of all sorts. To that end, I really like that you cut this sprout and called it So once we strip that we are left with — despite the name — a git hook manager similar to Husky, contrary to pre-commit does make version controlled pretentions about which hooks to be installed. See also:
Contrary to pre-commit, it also cleans up after itself, by default. I like husky's approach better and I think we should take the liberty and "fix" pre-commit for the nix community. I can assure you, pre-commit's model is not useful as-is for me who has to make sure my collaborator is always up to date with the latest coding guidelines. That's why I'm turning to nix altogether in the first place. |
At first glance, husky doesn't seem to provide help with the optimization of running only on modified files. Also iirc some users of this project also use or want to use existing non-Nixified pre-commit "repos" (packaged via other language-specific means) I don't think it would be beneficial to kick out pre-commit in favor of another tool for these reasons. |
@roberth Totally agree with both apsects (keeping pre-commit and working around its limitations). Thanks for your opinion! Counting your vote, my implicit vote (via this PR) and @domenkozar apparent abstention for a clear vote (please correct), I might summarize that we agree moving forward with what this PR tries to attempt. I have already deployed it in our organization and did a last fixup yesterday. Therefore, may I suggest you proceed with a formal incremental review? |
Oh, I'll have a look at the tests after lunch. |
Shall we proceed? |
Ahm... From the CI. error: attribute 'Cabal_3_0_0_0' missing, at /home/runner/work/pre-commit-hooks.nix/pre-commit-hooks.nix/nix/default.nix:20:27
(use '--show-trace' to show detailed location information)
##[error]Process completed with exit code 1. I hope that's not because of my latest commit, if so, I'd ask you to solve this the right way so I can learn by example. |
@domenkozar What's holding this back? Is it time? |
Bumping nixpkgs to master broke a few things, so we probably best revert that and have two versions of nixpkgs for tooling. I think eventually we'll need that sooner than later. |
Co-authored-by: Robert Hensing <[email protected]>
This reverts commit bf4b11f. The latest nixpkgs version still breakes things.
@domenkozar Ok I reverted it but I do unfortunately not know how to enable two Since on my side this is at sharp risk of getting stale, and I'm not able to give it the final touch, might I ask for your help to finish this off? |
Since I don't have time for this I recommend we wait for 20.10 to come out and pin that one which should also unblock this merge. |
Alright master is ready! |
replaced by #79 |
closes #49
Since I'm a newcomer, I have no way to judge (or even validate) if that's the right way at all: it's a shot into the darknix.
If it's a hit, I appreciate that I could seamlessly contribute. If it's a miss, please guild me around to get this merge-ready.