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>
This commit is contained in:
parent
379db31ea2
commit
5cb16aebcc
@ -4,7 +4,7 @@ default_language_version:
|
||||
python: python3
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v3.4.0
|
||||
rev: v4.4.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: mixed-line-ending
|
||||
@ -17,13 +17,18 @@ repos:
|
||||
- id: check-yaml
|
||||
files: .*\.(yaml|yml)$
|
||||
args: ['--unsafe']
|
||||
- repo: https://github.com/PyCQA/bandit
|
||||
rev: 1.7.5
|
||||
hooks:
|
||||
- id: bandit
|
||||
args: ['-x', 'tests', '-s', 'B105,B106,B107,B401,B404,B603,B606,B607,B110,B605,B101']
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: flake8
|
||||
name: flake8
|
||||
additional_dependencies:
|
||||
- hacking>=2.0.0
|
||||
- flake8-import-order>=0.13
|
||||
- hacking>=6.0.1,<6.1.0
|
||||
- flake8-import-order>=0.18.2,<0.19.0
|
||||
language: python
|
||||
entry: flake8
|
||||
files: '^.*\.py$'
|
||||
|
@ -1,15 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $(dirname "$0")/..
|
||||
CHANGED=$(git diff --name-only HEAD~1 | tr '\n' ' ')
|
||||
|
||||
# Skip files that don't exist
|
||||
# (have been git rm'd)
|
||||
CHECK=""
|
||||
for FILE in $CHANGED; do
|
||||
if [ -f "$FILE" ]; then
|
||||
CHECK="$CHECK $FILE"
|
||||
fi
|
||||
done
|
||||
|
||||
diff -u --from-file /dev/null $CHECK | flake8 --diff
|
19
tox.ini
19
tox.ini
@ -21,22 +21,11 @@ deps =
|
||||
commands = stestr run {posargs}
|
||||
allowlist_externals = stestr
|
||||
|
||||
[testenv:fast8]
|
||||
# Use same environment directory as pep8 env to save space and install time
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
envdir = {toxworkdir}/pep8
|
||||
commands =
|
||||
{toxinidir}/tools/fast8.sh
|
||||
|
||||
[testenv:pep8]
|
||||
deps =
|
||||
hacking>=2.0.0
|
||||
bandit!=1.6.0,>=1.1.0
|
||||
flake8-import-order>=0.13 # LGPLv3
|
||||
pre-commit
|
||||
commands =
|
||||
flake8
|
||||
bandit -r openstackclient -x tests -s B105,B106,B107,B401,B404,B603,B606,B607,B110,B605,B101
|
||||
pre-commit run --all-files --show-diff-on-failure
|
||||
|
||||
[testenv:bandit]
|
||||
# This command runs the bandit security linter against the openstackclient
|
||||
@ -76,9 +65,9 @@ commands =
|
||||
allowlist_externals = stestr
|
||||
|
||||
[testenv:functional]
|
||||
setenv =
|
||||
setenv =
|
||||
OS_TEST_PATH=./openstackclient/tests/functional
|
||||
passenv =
|
||||
passenv =
|
||||
OS_*
|
||||
commands =
|
||||
stestr run {posargs}
|
||||
|
Loading…
x
Reference in New Issue
Block a user