diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..4033ee7 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,24 @@ +repos: +- repo: https://github.com/ambv/black + rev: 18.6b4 + hooks: + - id: black + args: [--safe, --quiet] + language_version: python3.6 +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v1.3.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: debug-statements + - id: flake8 +- repo: local + hooks: + - id: rst + name: rst + entry: rst-lint --encoding utf-8 + files: ^(CHANGELOG.rst|HOWTORELEASE.rst|README.rst|changelog/.*)$ + language: python + additional_dependencies: [pygments, restructuredtext_lint] + python_version: python3.6 diff --git a/.travis.yml b/.travis.yml index 080d750..9f142f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,12 +25,17 @@ install: pip install tox setuptools_scm script: tox stages: +- linting - test - name: deploy if: repo = pytest-dev/pytest-xdist AND tag IS present jobs: include: + - stage: linting + python: '3.6' + script: + - tox -e linting - stage: test # python x env above are already included into this stage - python: "2.7" diff --git a/tox.ini b/tox.ini index 48b9e83..f0e63da 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,10 @@ [tox] # if you change the envlist, please update .travis.yml file as well envlist= + linting py{27,34,35,36}-pytest{34,35,36} py{27,36}-pytest36-pexpect py{27,36}-pytest{master,features} - flakes - readme [testenv] @@ -28,16 +27,11 @@ commands= py.cleanup -aq pytest {posargs} -[testenv:flakes] +[testenv:linting] changedir= -deps = flake8 -commands = flake8 setup.py testing xdist - -[testenv:readme] -changedir = -deps = readme -skip_install = true -commands = python setup.py check -r -s +deps = + pre-commit +commands = pre-commit run --all [testenv:release] changedir=