Skip to content

Commit 80a2b01

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "tox: Use pre-commit for pep8 target"
2 parents a43728d + 2ffdf2e commit 80a2b01

File tree

2 files changed

+15
-27
lines changed

2 files changed

+15
-27
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ repos:
1616
- id: debug-statements
1717
# nova/cmd/manage.py imports pdb on purpose.
1818
exclude: 'nova/cmd/manage.py'
19+
- id: check-json
20+
files: .*\.json$
1921
- id: check-yaml
2022
files: .*\.(yaml|yml)$
2123
- repo: https://github.com/Lucas-C/pre-commit-hooks

tox.ini

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -107,43 +107,29 @@ extras =
107107
commands =
108108
bash tools/mypywrap.sh {posargs}
109109

110-
[testenv:codespell]
111-
description =
112-
Run codespell to check spelling.
113-
deps =
114-
pre-commit
115-
commands =
116-
pre-commit run codespell --all-files --show-diff-on-failure
117-
118110
[testenv:pep8]
119111
description =
120112
Run style checks.
121113
deps =
122-
{[testenv]deps}
123-
{[testenv:codespell]deps}
124-
autopep8
114+
pre-commit
125115
extras =
126116
commands =
127-
{[testenv:mypy]commands}
128-
{[testenv:codespell]commands}
129-
# check if autopep8 would alter the formatting but don't actually change it
130-
# so we can gate on this in the ci
131-
autopep8 --exit-code --max-line-length=79 --diff -r nova doc setup.py
132-
# since autopep8 only tries to make minimal changes to conform to pep8 we still need to run
133-
# our hacking and flake8 check to keep our existing code style consistent.
134-
# The full list of issues addressable by autopep8 can be found here
135-
# https://pypi.org/project/autopep8/#features
136-
bash tools/flake8wrap.sh {posargs}
137-
# Check that all JSON files don't have \r\n in line.
138-
bash -c "! find doc/ -type f -name *.json | xargs grep -U -n $'\r'"
139-
# Check that all included JSON files are valid JSON
140-
bash -c '! find doc/ -type f -name *.json | xargs -t -n1 python -m json.tool 2>&1 > /dev/null | grep -B1 -v ^python'
117+
pre-commit run --all-files --show-diff-on-failure
141118

142119
[testenv:autopep8]
143120
extras =
144-
deps = autopep8
121+
deps =
122+
pre-commit
123+
commands =
124+
pre-commit run --all-files --show-diff-on-failure autopep8
125+
126+
[testenv:codespell]
127+
description =
128+
Run codespell to check spelling.
129+
deps =
130+
pre-commit
145131
commands =
146-
autopep8 --exit-code --max-line-length=79 --in-place -r nova doc setup.py
132+
pre-commit run --all-files --show-diff-on-failure codespell
147133

148134
[testenv:fast8]
149135
description =

0 commit comments

Comments
 (0)