diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..10268ec --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,25 @@ +- repo: git@github.com:pre-commit/pre-commit-hooks.git + sha: 6f2b0a27e5b9047c6c067fb3d575ba323d572793 + hooks: + - id: autopep8-wrapper + args: + - --in-place + - --aggressive + - --aggressive + - id: check-added-large-files + - id: check-ast + - id: check-case-conflict + - id: check-docstring-first + - id: debug-statements + - id: double-quote-string-fixer + - id: end-of-file-fixer + - id: fix-encoding-pragma + - id: flake8 + args: [--ignore=E731] + - id: requirements-txt-fixer + - id: trailing-whitespace +- repo: git@github.com:asottile/reorder_python_imports.git + sha: 017e2f64306853ec7f000db52b8280da27eb3b96 + hooks: + - id: reorder-python-imports + language_version: python2.7 diff --git a/Makefile b/Makefile index 99c4bac..358f22f 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,10 @@ docs: pandoc -s -w markdown docs/header.md docs/install.md docs/body.md -o README.md flake8: - @flake8 ./ --config=tox.ini + @tox -e flake8 + +pre-commit: + @tox -e pre-commit -- install -f --install-hooks release: docs # Check for tag existence @@ -38,11 +41,11 @@ tar: git archive --format=tar --prefix autojump_v$(VERSION)/ $(TAGNAME) | gzip > autojump_v$(VERSION).tar.gz sha1sum autojump_v$(VERSION).tar.gz -test: lint - @find . -type f -iname "*.pyc" -delete +test: pre-commit lint + @find . -type f -iname '*.py[co]' -delete tox tox -e flake8 -test-fast: - @find . -type f -iname "*.pyc" -delete +test-fast: pre-commit + @find . -type f -iname '*.py[co]' -delete tox -e py27 diff --git a/tox.ini b/tox.ini index f2c9332..66eba89 100644 --- a/tox.ini +++ b/tox.ini @@ -8,7 +8,7 @@ envlist = # ignore missing setup.py skipsdist = True -[testenv] +[testenv:py] setenv = PYTHONDONTWRITEBYTECODE = 1 deps = @@ -30,6 +30,12 @@ deps = commands = flake8 . +[testenv:pre-commit] +deps = + pre-commit +command = + pre-commit {posargs} + [flake8] filename = *.py,