Skip to content
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

On-demand config validation #665

Open
nachtjasmin opened this issue Mar 4, 2024 · 2 comments
Open

On-demand config validation #665

nachtjasmin opened this issue Mar 4, 2024 · 2 comments
Labels
feature request A new lefthook feature description

Comments

@nachtjasmin
Copy link

nachtjasmin commented Mar 4, 2024

⚡ Summary

I'd like to see some on-demand validation when I invoke lefthook. Alternatively, it could insert an automatic pre-commit check when the configuration changes.

Value

After updating to 1.6, I first simply changed remote to remotes by intent. lefthook still ran without any warnings or errors. I also have to look up every time whether it's called stage_fixed, stage_changed, stage_changes or something else. Editing the lefthook.yml is something I rarely do and if lefthook runs, I assume that the configuration is valid.

Behavior and configuration changes

There should be printed a warning, if there's a configuration key in the wrong format or not known to lefthook. For example, if I add a stage_changes key to one of the commands, I'd like to see an warning like:

WARNING: "stage_changes" is not known, maybe you mean "stage_fixed"?

An automatic pre-commit check for changes to the lefthook config file would be nice as well, but could be easily added manually if a lefthook verify command is added.

@nachtjasmin nachtjasmin added the feature request A new lefthook feature description label Mar 4, 2024
@mrexox
Copy link
Member

mrexox commented Mar 5, 2024

Thank you! This is a really good feature to have. I will think it out. Right now lefthook can only notify about deprecated options, and adding a verify step would be really helpful.

@createchange
Copy link

Seconding this. On great advice in another thread, I tried to introduce fail_text. However, my brain wasn't functioning, as I instead defined a value for error_text. The job ran still but the error I introduced didn't trigger the text like I assumed would happen. An error stating that I was using an undefined key would be wonderful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A new lefthook feature description
Projects
None yet
Development

No branches or pull requests

3 participants