diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..fe26568c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,5 @@ +repos: + - repo: https://github.com/psf/black + rev: 19.10b0 + hooks: + - id: black diff --git a/.travis.yml b/.travis.yml index f0563a3a..f90584dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ language: python cache: directories: - $HOME/miniconda3 + - $HOME/.cache/pre-commit addons: apt_packages: @@ -24,6 +25,7 @@ env: - TESTCMD="--cov-append csrank/tests/test_fate.py csrank/tests/test_losses.py csrank/tests/test_metrics.py csrank/tests/test_tuning.py csrank/tests/test_util.py csrank/tests/test_tuning.py csrank/tests/test_callbacks.py" script: + - pre-commit run --all-files # https://pre-commit.com/#usage-in-continuous-integration - pytest -v --cov=csrank --ignore experiments $TESTCMD - travis-sphinx --outdir docs/_build build -n --source=docs diff --git a/requirements-dev.txt b/requirements-dev.txt index 8b2b172a..e496cb1e 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -15,3 +15,4 @@ theano>=1.0 # Pick either CPU or GPU version of tensorflow: tensorflow>=1.5,<2.0 # tensorflow-gpu>=1.0.1 +pre-commit