Bump pre-commit-config versions
Bumped hacking, etc, versions in .pre-commit-config.yaml Added some additional checks and fixed any complaints they found. Also enabled flake8-logging-format (G) rules and fixed issues it found. TrivialFix Change-Id: I2b807e553a1ca312371e573941d71366a717b50a Signed-off-by: Brian Haley <haleyb.dev@gmail.com>
This commit is contained in:
@@ -4,19 +4,29 @@ default_language_version:
|
||||
python: python3
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v5.0.0
|
||||
rev: v6.0.0
|
||||
hooks:
|
||||
# whitespace
|
||||
- id: trailing-whitespace
|
||||
- id: mixed-line-ending
|
||||
args: ['--fix', 'lf']
|
||||
exclude: '.*\.(svg)$'
|
||||
- id: check-byte-order-marker
|
||||
# file format and permissions
|
||||
- id: fix-byte-order-marker
|
||||
- id: check-executables-have-shebangs
|
||||
- id: check-shebang-scripts-are-executable
|
||||
- id: check-json
|
||||
- id: check-merge-conflict
|
||||
- id: debug-statements
|
||||
- id: check-yaml
|
||||
files: .*\.(yaml|yml)$
|
||||
# git
|
||||
- id: check-added-large-files
|
||||
- id: check-merge-conflict
|
||||
- id: check-case-conflict
|
||||
- id: detect-private-key
|
||||
# python
|
||||
- id: debug-statements
|
||||
- id: check-docstring-first
|
||||
exclude: 'neutron_lib/api/definitions/taas.py'
|
||||
- repo: https://github.com/PyCQA/bandit
|
||||
rev: 1.8.3
|
||||
hooks:
|
||||
@@ -29,30 +39,41 @@ repos:
|
||||
files: 'neutron_lib/'
|
||||
exclude: 'neutron_lib/tests'
|
||||
- repo: https://github.com/lucas-c/pre-commit-hooks
|
||||
rev: v1.5.5
|
||||
rev: v1.5.6
|
||||
hooks:
|
||||
- id: remove-tabs
|
||||
exclude: '.*\.(svg)$'
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.12.1
|
||||
rev: v0.15.0
|
||||
hooks:
|
||||
- id: ruff-check
|
||||
args: ['--fix', '--unsafe-fixes']
|
||||
- repo: https://github.com/hhatto/autopep8
|
||||
rev: v2.3.2
|
||||
hooks:
|
||||
- id: autopep8
|
||||
files: '^.*\.py$'
|
||||
# Run hacking after autopep8 so that if it can fix
|
||||
# it, it will. Note it will still fail in CI because
|
||||
# fixing an issue changes the code and that should
|
||||
# not happen in CI.
|
||||
- repo: https://opendev.org/openstack/hacking
|
||||
rev: 7.0.0
|
||||
rev: 8.0.0
|
||||
hooks:
|
||||
- id: hacking
|
||||
additional_dependencies:
|
||||
- flake8-import-order~=0.19.0
|
||||
- neutron
|
||||
exclude: '^(doc|releasenotes|tools)/.*$'
|
||||
- repo: https://github.com/hhatto/autopep8
|
||||
rev: v2.3.2
|
||||
- repo: https://github.com/sphinx-contrib/sphinx-lint
|
||||
rev: v1.0.2
|
||||
hooks:
|
||||
- id: autopep8
|
||||
files: '^.*\.py$'
|
||||
- id: sphinx-lint
|
||||
args: []
|
||||
files: ^doc|releasenotes
|
||||
types: [rst]
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.16.1
|
||||
rev: v1.19.1
|
||||
hooks:
|
||||
- id: mypy
|
||||
pass_filenames: false
|
||||
|
||||
@@ -214,7 +214,7 @@ def timecost(f):
|
||||
|
||||
@timeutils.time_it(LOG, message=end_message, min_duration=None)
|
||||
def wrapper(*args, **kwargs):
|
||||
LOG.debug(message_base + "start")
|
||||
LOG.debug('%s start', message_base)
|
||||
ret = f(*args, **kwargs)
|
||||
return ret
|
||||
return wrapper
|
||||
|
||||
@@ -119,10 +119,11 @@ def load_class_by_alias_or_classname(namespace, name):
|
||||
try:
|
||||
class_to_load = importutils.import_class(name)
|
||||
except (ImportError, ValueError) as e:
|
||||
e2_info = sys.exc_info()
|
||||
LOG.error("Error loading class by alias",
|
||||
exc_info=e1_info)
|
||||
LOG.error("Error loading class by class name",
|
||||
exc_info=True)
|
||||
exc_info=e2_info)
|
||||
raise ImportError(_("Class not found.")) from e
|
||||
return class_to_load
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ files = "neutron_lib"
|
||||
line-length = 79
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = ["E4", "E5", "E7", "E9", "F", "S", "UP"]
|
||||
select = ["E4", "E5", "E7", "E9", "F", "G", "S", "UP"]
|
||||
ignore = [
|
||||
"S104", # Possible binding to all interfaces
|
||||
"S311", # Suspicious non-cryptographic random usage
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||
hacking>=6.1.0,<6.2.0 # Apache-2.0
|
||||
hacking>=6.1.0,<=8.0.0 # Apache-2.0
|
||||
oslotest>=3.2.0 # Apache-2.0
|
||||
stestr>=1.0.0 # Apache-2.0
|
||||
testtools>=2.2.0 # MIT
|
||||
|
||||
Reference in New Issue
Block a user