diff --git a/.githooks/pre-commit b/.githooks/pre-commit deleted file mode 100644 index 29b97a1..0000000 --- a/.githooks/pre-commit +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# to activate this git pre commit file run the following command; -# git config core.hooksPath .githooks - -# get added and modified python files -for file in $(git diff --cached --name-only --diff-filter=AM | grep -E '\.(py)$') - -# run black -do - black "$file" - - $(git add "$file") - - done - - diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..2f763ea --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,9 @@ +repos: +- repo: https://github.com/psf/black + rev: 19.3b0 + hooks: + - id: black +- repo: https://github.com/PyCQA/flake8 + rev: 3.9.2 + hooks: + - id: flake8 \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt index 58e67f2..10d78d6 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,6 +3,7 @@ pytest>=5.4.1 pytest-mock>=3.0.0 pytest-cov>=2.10.1 pytest-benchmark +pre-commit==2.15.0 black>=19.10b0 flake8==3.8.4 bandit>=1.7.0 \ No newline at end of file