From 797f40aa4320ea83da4190ad7735ebe0e594e796 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 2 Feb 2024 21:45:34 +0900 Subject: [PATCH] pre-commit: Integrate bandit We also remove these unnecessary linter dependencies from test-requirements.txt. Co-Authored-By: Stephen Finucane Change-Id: Id17f4865b2da9f4a5c1cd5ea360cd007315d1c0e --- .pre-commit-config.yaml | 5 +++++ test-requirements.txt | 5 ----- tox.ini | 5 ++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 07917d3..6937157 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,3 +23,8 @@ repos: hooks: - id: hacking additional_dependencies: [] + - repo: https://github.com/PyCQA/bandit + rev: 1.7.6 + hooks: + - id: bandit + args: ['-x', 'tests', '-s', 'B311,B404,B603,B606'] diff --git a/test-requirements.txt b/test-requirements.txt index 521e593..3aa5639 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,8 +3,3 @@ coverage!=4.4,>=4.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD stestr>=2.0.0 # Apache-2.0 eventlet>=0.19.0 # MIT - -# Bandit security code scanner -bandit>=1.7.0,<1.8.0 # Apache-2.0 - -pre-commit>=2.6.0 # MIT diff --git a/tox.ini b/tox.ini index 09e294c..bc4f5c7 100644 --- a/tox.ini +++ b/tox.ini @@ -13,11 +13,10 @@ commands = env TEST_EVENTLET=1 lockutils-wrapper stestr run --slowest {posargs} [testenv:pep8] -deps = {[testenv]deps} +deps = + pre-commit commands = pre-commit run -a - # Run security linter - bandit -r oslo_concurrency -x tests -n5 --skip B311,B404,B603,B606 [testenv:venv] commands = {posargs}