Skip to content

Commit 5cb16ae

Browse files
committed
Use pre-commit for 'pep8' tox target, bump versions
We want to bump the versions of hacking, but doing so requires changes in two places: '.pre-commit-config.yaml' and 'tox.ini'. This is silly: we can simply use tox to handle pre-commit and leave all other dependencies to pre-commit. Do this, migrating bandit to pre-commit and bumping the other dependencies in the process. We remove the 'fast8' target and tool, since pre-commit is plenty fast here. Change-Id: Ifdc582ecc3b4479ea9ed9abcb16577c6e8b2f5c1 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
1 parent 379db31 commit 5cb16ae

File tree

3 files changed

+12
-33
lines changed

3 files changed

+12
-33
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ default_language_version:
44
python: python3
55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v3.4.0
7+
rev: v4.4.0
88
hooks:
99
- id: trailing-whitespace
1010
- id: mixed-line-ending
@@ -17,13 +17,18 @@ repos:
1717
- id: check-yaml
1818
files: .*\.(yaml|yml)$
1919
args: ['--unsafe']
20+
- repo: https://github.com/PyCQA/bandit
21+
rev: 1.7.5
22+
hooks:
23+
- id: bandit
24+
args: ['-x', 'tests', '-s', 'B105,B106,B107,B401,B404,B603,B606,B607,B110,B605,B101']
2025
- repo: local
2126
hooks:
2227
- id: flake8
2328
name: flake8
2429
additional_dependencies:
25-
- hacking>=2.0.0
26-
- flake8-import-order>=0.13
30+
- hacking>=6.0.1,<6.1.0
31+
- flake8-import-order>=0.18.2,<0.19.0
2732
language: python
2833
entry: flake8
2934
files: '^.*\.py$'

tools/fast8.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

tox.ini

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,11 @@ deps =
2121
commands = stestr run {posargs}
2222
allowlist_externals = stestr
2323

24-
[testenv:fast8]
25-
# Use same environment directory as pep8 env to save space and install time
26-
setenv =
27-
VIRTUAL_ENV={envdir}
28-
envdir = {toxworkdir}/pep8
29-
commands =
30-
{toxinidir}/tools/fast8.sh
31-
3224
[testenv:pep8]
3325
deps =
34-
hacking>=2.0.0
35-
bandit!=1.6.0,>=1.1.0
36-
flake8-import-order>=0.13 # LGPLv3
26+
pre-commit
3727
commands =
38-
flake8
39-
bandit -r openstackclient -x tests -s B105,B106,B107,B401,B404,B603,B606,B607,B110,B605,B101
28+
pre-commit run --all-files --show-diff-on-failure
4029

4130
[testenv:bandit]
4231
# This command runs the bandit security linter against the openstackclient
@@ -76,9 +65,9 @@ commands =
7665
allowlist_externals = stestr
7766

7867
[testenv:functional]
79-
setenv =
68+
setenv =
8069
OS_TEST_PATH=./openstackclient/tests/functional
81-
passenv =
70+
passenv =
8271
OS_*
8372
commands =
8473
stestr run {posargs}

0 commit comments

Comments
 (0)