Add pre-commit files and linting using pre-commit

This commit is contained in:
Bruno Oliveira
2018-07-27 17:46:25 -03:00
parent 3776f3b74b
commit 1ed3884da9
3 changed files with 34 additions and 11 deletions

24
.pre-commit-config.yaml Normal file
View File

@@ -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

View File

@@ -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"

16
tox.ini
View File

@@ -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=