diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..8bf7e18 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,30 @@ +repos: + - repo: https://github.com/asottile/pyupgrade + rev: v2.11.0 + hooks: + - id: pyupgrade + args: + - --keep-percent-format + + - repo: https://github.com/psf/black + rev: 20.8b1 + hooks: + - id: black + + - repo: https://gitlab.com/pycqa/flake8 + rev: 3.9.0 + hooks: + - id: flake8 + + - repo: https://github.com/asottile/yesqa + rev: v1.2.2 + hooks: + - id: yesqa + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.4.0 + hooks: + - id: check-merge-conflict + - id: check-toml + - id: check-yaml + - id: mixed-line-ending diff --git a/.travis.yml b/.travis.yml index a1fb988..d298db5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,11 +24,9 @@ matrix: env: TOX_ENV=tests - python: 3.9 env: TOX_ENV=tests - - env: TOX_ENV=black - env: TOX_ENV=mypy - env: TOX_ENV=apidocs - env: PUSH_DOCS=true - - env: TOX_ENV=check-manifest script: - if [[ -n "${TOX_ENV}" ]]; then tox -e $TOX_ENV; fi diff --git a/setup.cfg b/setup.cfg index a99c870..f8783bb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -48,3 +48,8 @@ mypy = [bdist_wheel] universal = 1 + +[flake8] +max-line-length = 88 +extend-ignore = + E203, # whitespace before : is not PEP8 compliant (& conflicts with black) diff --git a/tox.ini b/tox.ini index 7640148..df13907 100644 --- a/tox.ini +++ b/tox.ini @@ -7,7 +7,6 @@ isolated_build = true envlist = flake8, tests, - check-manifest, apidocs @@ -17,25 +16,18 @@ wheel_build_env = build deps = tests: coverage apidocs: pydoctor - check-manifest: check-manifest - black: black - black-reformat: black + lint: pre-commit extras = mypy: mypy tests: scripts -setenv = - black: BLACK_LINT_ARGS=--check - commands = python -V - black: black {env:BLACK_LINT_ARGS} . + lint: pre-commit run --all-files --show-diff-on-failure apidocs: pydoctor -q --project-name incremental src/incremental - check-manifest: check-manifest -v - tests: coverage --version tests: {envbindir}/trial --version tests: coverage erase @@ -47,10 +39,6 @@ commands = tests: coverage html mypy: mypy src -[testenv:black-reformat] -setenv = -; Clear the --check flag - BLACK_LINT_ARGS= [testenv:build] # empty environment to build universal wheel once per tox invocation