From 3f1b936827be1b8c0f2e39a3d8cc34ad05bfd85a Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Mon, 4 Sep 2023 16:17:09 +0100 Subject: [PATCH] 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 --- .git-blame-ignore-revs | 4 ++++ test-requirements.txt | 3 --- tox.ini | 13 +++++-------- 3 files changed, 9 insertions(+), 11 deletions(-) create mode 100644 .git-blame-ignore-revs diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000..352e5efb --- /dev/null +++ b/.git-blame-ignore-revs @@ -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 diff --git a/test-requirements.txt b/test-requirements.txt index d59d8131..22ecaf81 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -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 diff --git a/tox.ini b/tox.ini index 7d534a9b..407ddef1 100644 --- a/tox.ini +++ b/tox.ini @@ -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