git: add pre-commit dependency

This also adds documentation for how to install this git pre-commit hook
which will run black before committing. The only downside to doing that
is the, perhaps confusing, initial run which will clone the black
repository before a dev's first commit.

Running on the command-line will be quite obvsious since the default
output shows what pre-commit is doing. But running in a gui or
editor (e.g. magit) will hide that. Viewer discretion is advised.
This commit is contained in:
Sean Farley 2019-07-13 14:46:47 -05:00
parent b570b50836
commit ec3d2ca8ad
4 changed files with 11 additions and 0 deletions

5
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,5 @@
repos:
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black

View file

@ -130,6 +130,10 @@ our tests)::
$ black --check --exclude=xonsh/ply/ xonsh/ xontrib/
To add this as a git pre-commit hook::
$ pre-commit install
**********
Imports
**********

View file

@ -9,3 +9,4 @@ matplotlib
doctr
tornado
black
pre-commit

View file

@ -9,3 +9,4 @@ pygments>=2.2
codecov
coverage
black
pre-commit