tox: Use pre-commit for linter checks

We also add a .git-blame-ignore-revs file to ignore the application of
black.

Change-Id: I0522041dfc0b2d97c6a0648271626bab30322fd7
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane 2023-09-04 16:17:09 +01:00
parent 088b1e200f
commit 3f1b936827
3 changed files with 9 additions and 11 deletions

4
.git-blame-ignore-revs Normal file
View File

@ -0,0 +1,4 @@
# You can configure git to automatically use this file with the following config:
# git config --global blame.ignoreRevsFile .git-blame-ignore-revs
7be7b1ab79814925f6d73ed97407ae19796ddd05 # Blacken code base

View File

@ -7,6 +7,3 @@ coverage>=5.0 # Apache-2.0
# sphinx is required in test-requirements in addition to doc/requirements
# because there is a sphinx extension that has tests
sphinx>=5.0.0 # BSD
# Bandit security code scanner
bandit>=1.1.0 # Apache-2.0

13
tox.ini
View File

@ -1,16 +1,13 @@
[tox]
minversion = 3.1.0
envlist = py3,pep8
ignore_basepython_conflict = True
[testenv]
basepython = python3
setenv =
VIRTUAL_ENV={envdir}
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=60
distribute = False
commands =
stestr run {posargs}
stestr slowest
@ -20,13 +17,13 @@ deps =
-r{toxinidir}/requirements.txt
[testenv:pep8]
description =
Run style checks.
skip_install = true
deps =
-r{toxinidir}/test-requirements.txt
flake8
pre-commit
commands =
flake8 cliff doc/source/conf.py setup.py
# Run security linter
bandit -c bandit.yaml -r cliff -x tests -n5
pre-commit run --all-files --show-diff-on-failure
[testenv:venv]
# TODO(modred) remove doc/requirements.txt once the openstack-build-sphinx-docs