pierky / arouteserver

A tool to automatically build (and test) feature-rich configurations for BGP route servers.
https://arouteserver.readthedocs.org/
GNU General Public License v3.0
284 stars 46 forks source link

Git pre-commit: Add barebones config file #125

Open netravnen opened 11 months ago

netravnen commented 11 months ago

https://pre-commit.com/

netravnen commented 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.

netravnen commented 11 months ago

@pierky do you think this suggestion is worth adding?

pierky commented 10 months ago

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)?

netravnen commented 10 months ago

Narrowing the scope to core files would be a good start. Causing the least friction.

Will update the branch with this suggestion.