Pre-commit hooks


Pre-commit is a nice, simple tool to add Git hooks to your project. The primary goal is running fast checks on commits (before committing them), mainly linters and syntax checkers. Today I've 2 of my own, for Ansible playbooks and shell scripts. The Ansible playbooks hook is located at and the shell scripts hook is at Both have a short README which describes installation and usage.

My view on testing

I find that Pre-commit suites my view on proportionate testing. The smaller the change, the faster the test (and as a result, more trivial). Personally, I prefer to structure my work as small commits that are easier to revert, these deserve fast (and more trivial) tests which Pre-commit provides. The bigger the change, the more rigorous (and thus longer) the test. In my opinion this helps in creating a good workflow which quickly finds small errors while developing and reduces the number of times one must ran the full test suite because he/she had a typo that failed the test. This is why I prefer to separate the test suite so that I can the ability to run the simpler and faster locally and get rid of simple error quickly.