lefthook
lefthook copied to clipboard
Reduce the noise
There's too much noise:
Lefthook v0.6.3
RUNNING HOOKS GROUP: pre-commit
EXECUTE > yamllint
(SKIP. NO FILES FOR INSPECTING)
EXECUTE > jsonnet-fmt
(SKIP. NO FILES FOR INSPECTING)
EXECUTE > vault-policy-fmt
SUMMARY: (done in 479.47 seconds)
✔️ vault-policy-fmt
This is good for debugging purposes, but if you have tens of different commands and just changed a single file, seeing all this is not signal, but noise. Showing the program and the version number is unnecessary either (if one cares, they can see that with lefthook version
).
Hi @nikolay, thank you for feedback.
The reason why Lefthook v0.6.3
exists in the output, because we have a lot of inexperienced users, which have a problems with understanding which version they run. Yep it noisy, but help a lot for some group of users.
I can add a flag for config file, like short_output: true
or only_summary: true
.
What output format do you recommend?
Yes, keep the default "as is", but add options to limit the output as, honestly, I personally don't mind more info, but I know some people will be bothered and this can affect the adoption. It would be much easier for me to get buy-in if there's change-relevant output only.
Agreed. Usually I use -q
on lint-staged during development to hide any output except errors. The reason is simple: I use WebStorm and it cuts git-hook output when it's too much long (for WS “too much” means “≈ more than 10 lines”). So these success messages can push out useful error messages into ugly popup which breaks formatting and completely unreadable.
I understand that it's not a lefthook's fault, but WS's. However I would much appreciate an option like silent: true
.
(Anyway, thanks for the fast tool. I really like how it feels that it works at least 4 times faster than husky + lint-staged.)
I think about modular output, like this one:
output:
- meta #(version and which hook running)
- failures #(output from runners with exit code nonzero)
- success #(output from runners with exit code 0)
- summary #(summary block)
Thank you, @Arkweid! This looks granular enough!
I think, it can be great to add logrus
to this project to made it possible. wdyt?
That make sense.
I think about modular output, like this one:
output: - meta #(version and which hook running) - failures #(output from runners with exit code nonzero) - success #(output from runners with exit code 0) - summary #(summary block)
Would be nice if it would be possible to configure the output via ENV. And have an option to output summary only in case of failures only. Perfectly as one-liner. Right now it's kinda very difficult to use lefthook with tig
.
The reason why Lefthook v0.6.3 exists in the output, because we have a lot of inexperienced users, which have a problems with understanding which version they run. Yep it noisy, but help a lot for some group of users.
Other projects have solved this by adding an issue template reminding users to report their current version when posting an issue. That might be a less noisy way to achieve what you want here.
@thieman Yes. This is a tool for people who use Git, so, it is assumed that if they know how to use git, they can find the version of a CLI tool easily.
Yep - would be great to see this done too.
Modular output merged in master. It could be checked with this config:
skip_output:
- meta #(version and which hook running)
- success #(output from runners with exit code 0)
Is there any chance that there will be an option to configure it via ENV vars, e.g. LEFTHOOK_QUIET=meta,success
@ixti Yea, why not. PR always welcome :)
I have strong negative feelings about the log output of lefthook. 👀
Can we get a skip_output: true
option that silences everything (except errors)? 😅
(I don't know Go, or I would contribute)