osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What Python related git pre-commit hooks are you using?


On 2018-11-18, Malcolm Greene <python at bdurham.com> wrote:
> Curious to learn what Python related git pre-commit hooks people are
> using? What hooks have you found useful and which hooks have you tried
> and abandoned? Appreciate any suggestions for those new to this process.
> Background: Window, macOS, and Linux dev environments, PyCharm professional edition IDE, 64-bit Python 3.6, private Github repos. Considering black (standardize formatting), pylamas (multiple static code tests) and possibly a hook into our pytest test runner.

I wrote the following pre-commit hook, which is fairly specific to my
requirements but also fairly easy to customize. It (configurably)
checks text-type files for tabs, trailing whitespace and non-Unix
line endings, python files for syntax and with flake8 and pylint,
and JavaScript files with 'standard'. It works with Python 2 or 3.

https://github.com/jribbens/voting/blob/master/.githooks/pre-commit