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

@ -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

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

13
tox.ini

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