Skip to content

Commit 98b9ec6

Browse files
committed
Add pre-commit config and linting
* pre-commit config with common hooks used in pytest * Add "linting" tox-env * Add "testing" extras
1 parent 719ba65 commit 98b9ec6

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed

.pre-commit-config.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
exclude: doc/en/example/py2py3/test_py2.py
2+
repos:
3+
- repo: https://github.com/python/black
4+
rev: 19.3b0
5+
hooks:
6+
- id: black
7+
args: [--safe, --quiet]
8+
- repo: https://github.com/asottile/blacken-docs
9+
rev: v1.0.0
10+
hooks:
11+
- id: blacken-docs
12+
additional_dependencies: [black==19.3b0]
13+
- repo: https://github.com/pre-commit/pre-commit-hooks
14+
rev: v2.2.3
15+
hooks:
16+
- id: trailing-whitespace
17+
- id: end-of-file-fixer
18+
- id: fix-encoding-pragma
19+
- id: check-yaml
20+
- repo: https://github.com/asottile/reorder_python_imports
21+
rev: v1.4.0
22+
hooks:
23+
- id: reorder-python-imports
24+
args: ['--application-directories=execnet']
25+
- repo: local
26+
hooks:
27+
- id: rst
28+
name: rst
29+
entry: rst-lint --encoding utf-8
30+
files: ^(CHANGELOG.rst|HOWTORELEASE.rst|README.rst)$
31+
language: python
32+
additional_dependencies: [pygments, restructuredtext_lint]

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
- stage: baseline
1717
env: TOXENV=docs
1818
python: '3.6'
19+
- env: TOXENV=linting
20+
python: '3.6'
1921
- env: TOXENV=py27
2022
python: '2.7'
2123
- env: TOXENV=py37

setup.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ def main():
3434
packages=['execnet', 'execnet.script'],
3535
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
3636
install_requires=['apipkg>=1.4'],
37+
extras_require={
38+
"testing": [
39+
"pre-commit",
40+
],
41+
},
3742
setup_requires=['setuptools_scm'],
3843
)
3944

tox.ini

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist=py27,py34,py35,py36,py37,pypy,pypy3
2+
envlist=py27,py37,docs,linting
33

44
[testenv]
55
deps=
@@ -18,6 +18,12 @@ deps =
1818
commands =
1919
sphinx-build -W -b html . _build
2020

21+
[testenv:linting]
22+
skip_install = True
23+
basepython = python3
24+
deps = pre-commit>=1.11.0
25+
commands = pre-commit run --all-files --show-diff-on-failure
26+
2127
[pytest]
2228
timeout = 20
2329
addopts = -ra

0 commit comments

Comments
 (0)