Skip to content

Commit 98e01ab

Browse files
committed
add in pre-commit to repo and have it mirror the precommit as setup in pytest
1 parent be9f031 commit 98e01ab

2 files changed

Lines changed: 58 additions & 1 deletion

File tree

.pre-commit-config.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 19.10b0
4+
hooks:
5+
- id: black
6+
args: [--safe, --quiet]
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: v3.1.0
9+
hooks:
10+
- id: trailing-whitespace
11+
- id: end-of-file-fixer
12+
- id: fix-encoding-pragma
13+
args: [--remove]
14+
- id: check-yaml
15+
- id: debug-statements
16+
laneuage_version: python3
17+
exclude: _pytest/(debugging|hookspec).py
18+
- repo: https://gitlab.com/pycqa/flake8
19+
rev: 3.8.3
20+
hooks:
21+
- id: flake8
22+
language_version: python3
23+
additional_dependencies: [flake8-typing-imports==1.9.0]
24+
- repo: https://github.com/asottile/reorder_python_imports
25+
rev: v2.3.1
26+
hooks:
27+
- id: reorder-python-imports
28+
args: ['--application-directories=.:src', --py3-plus]
29+
- repo: https://github.com/asottile/pyupgrade
30+
rev: v2.7.1
31+
hooks:
32+
- id: pyupgrade
33+
args: [--py3-plus]
34+
- repo: https://github.com/asottile/setup-cfg-fmt
35+
rev: v1.10.0
36+
hooks:
37+
- id: setup-cfg-fmt
38+
- repo: local
39+
hooks:
40+
- id: rst
41+
name: rst
42+
entry: rst-lint --encoding utf-8
43+
files: ^(CHANGES.rst|README.rst)$
44+
language: python
45+
additional_dependencies: [pygments, restructuredtext_lint]

tox.ini

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
# and then run "tox" from this directory.
55

66
[tox]
7-
envlist = py{35,36,37,38,py3}-pytest{50,51,52,53,54},
7+
distshare = {homedir}/.tox/distshare
8+
envlist =
9+
linting
10+
py{35,36,37,38,py3}-pytest{50,51,52,53,54}
11+
isolated_build = True
12+
minversion = 3.5.3
813

914
[testenv]
1015
commands = py.test test_pytest_rerunfailures.py {posargs}
@@ -14,3 +19,10 @@ deps =
1419
pytest52: pytest==5.2.*
1520
pytest53: pytest==5.3.*
1621
pytest54: pytest==5.4.*
22+
23+
# potentially can add install_command ( see https://tox.readthedocs.io/en/latest/config.html?highlight=skip_install#conf-skip_install )
24+
[testenv:linting]
25+
basepython = python3
26+
commands = pre-commit run --all-files --show-diff-on-failure {posargs:}
27+
deps = pre-commit>=1.11.0
28+
skip_install = True

0 commit comments

Comments
 (0)