Open netravnen opened 11 months ago
Git pre-commit add the possibility to introduce project specific pre-commit checks out of the box locally on the endhost of the developer/user committing changes to their own fork of the repository. This has the benefit of some standard checks having been before a PR is ever opened.
@pierky do you think this suggestion is worth adding?
Hi @netravnen, I like the idea, however after I tested it I see that a lot of files would be modified because of several "inconsistencies". Most of the files identified by the precommit hooks are those which are generate automatically via Jinja2 templates, where having a wrong trailing space is pretty common (at least given the way they are built today). Also some YAML files which are purposely wrong are caught by the hooks. If we want to keep the linters are you suggested, we would need to add some exlude
patterns probably, at least to ignore those files. Otherwise, every time new files are automatically built, the precommit hooks would re-format them, causing additional "noise" in the commit history. Would you be able to narrow down the list of impacted files and exclude all those which are automatically generated, maybe by keeping only "core" files in scope (like Python files and a few others)?
Narrowing the scope to core files would be a good start. Causing the least friction.
Will update the branch with this suggestion.
https://pre-commit.com/