pre-commit: Integrate doc8 and bandit

We also remove these unnecessary linter dependencies from
test-requirements.txt.

The independent bandit target was removed because it's integrated to
the pep8 target.

Co-Authored-By: Stephen Finucane <sfinucan@redhat.com>
Change-Id: I094897e6de223753a5a497ec42348e4449132b17
This commit is contained in:
Takashi Kajinami 2024-01-30 15:51:41 +09:00
parent 6726f9100b
commit cf27f03c79
3 changed files with 20 additions and 19 deletions

View File

@ -23,3 +23,13 @@ repos:
hooks:
- id: hacking
additional_dependencies: []
- repo: https://github.com/PyCQA/bandit
rev: 1.7.6
hooks:
- id: bandit
args: ['-x', 'tests']
- repo: https://github.com/PyCQA/doc8
rev: v1.1.1
hooks:
- id: doc8

View File

@ -1,14 +1,6 @@
fixtures>=3.0.0 # Apache-2.0/BSD
hacking>=6.1.0,<6.2.0 # Apache-2.0
oslotest>=3.2.0 # Apache-2.0
requests>=2.14.2 # Apache-2.0
stestr>=2.0.0 # Apache-2.0
doc8>=0.6.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
# Bandit security code scanner
bandit>=1.7.0,<1.8.0 # Apache-2.0
pre-commit>=2.6.0 # MIT

21
tox.ini
View File

@ -1,6 +1,6 @@
[tox]
minversion = 3.2.0
envlist = py3,pep8,bandit
envlist = py3,pep8
[testenv]
setenv =
@ -9,7 +9,6 @@ setenv =
CLIENT_NAME=oslo.service
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
allowlist_externals = find
@ -18,10 +17,10 @@ commands =
stestr run --slowest {posargs}
[testenv:pep8]
deps =
pre-commit
commands =
pre-commit run -a
bandit -r oslo_service -n5 -x tests
doc8 --ignore-path "doc/source/history.rst" doc/source
[testenv:venv]
commands = {posargs}
@ -29,6 +28,10 @@ commands = {posargs}
[testenv:docs]
allowlist_externals =
rm
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
fixtures>=3.0.0 # Apache-2.0/BSD
commands =
rm -rf doc/build
sphinx-build -W --keep-going -b html doc/source doc/build/html {posargs}
@ -50,16 +53,12 @@ import_exceptions = oslo_service._i18n
[testenv:debug]
commands = oslo_debug_helper -t oslo_service/tests {posargs}
[testenv:bandit]
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
commands = bandit -r oslo_service -n5 -x tests {posargs}
[testenv:releasenotes]
allowlist_externals =
rm
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
commands =
rm -rf releasenotes/build
sphinx-build -a -E -W -d releasenotes/build/doctrees --keep-going -b html releasenotes/source releasenotes/build/html