Merge "pre-commit: Use local neutron hacking checks"

This commit is contained in:
Zuul
2025-09-11 11:35:43 +00:00
committed by Gerrit Code Review
3 changed files with 23 additions and 27 deletions

View File

@@ -42,7 +42,7 @@ repos:
rev: 7.0.0
hooks:
- id: hacking
additional_dependencies: ['neutron', 'neutron-lib']
additional_dependencies: ['neutron-lib>=3.21.1']
exclude: '^(doc|releasenotes|tools)/.*$'
- repo: https://github.com/hhatto/autopep8
rev: v2.3.2

View File

@@ -15,7 +15,7 @@ requests>=2.32.3 # Apache-2.0
Jinja2>=2.10 # BSD License (3 clause)
keystonemiddleware>=5.1.0 # Apache-2.0
netaddr>=0.7.18 # BSD
neutron-lib>=3.21.0 # Apache-2.0
neutron-lib>=3.21.1 # Apache-2.0
python-neutronclient>=7.8.0 # Apache-2.0
tenacity>=6.0.0 # Apache-2.0
SQLAlchemy>=1.4.23 # MIT

46
tox.ini
View File

@@ -210,37 +210,33 @@ select = H,N
# H204: Use assert(Not)Equal to check for equality
# H205: Use assert(Greater|Less)(Equal) for comparison
# H904: Delay string interpolations at logging calls
enable-extensions = H106,H203,H204,H205,H904
# N521: jsonutils must be used instead of json
# N524: Use of contextlib.nested is deprecated
# N529: Method's default argument shouldn't be mutable
# N530: Direct neutron imports not allowed
# N535: Usage of Python eventlet module not allowed
# N536: Use assertIsNone
enable-extensions = H106,H203,H204,H205,H904,N521,N524,N529,N530,N532,N534,N535,N536
ignore = H405,H701,H702,H703,N530,N535
show-source = true
exclude = ./.*,build,dist,doc
[flake8:local-plugins]
extension =
# Checks specific to neutron repo
N322 = neutron.hacking.checks:check_assert_called_once_with
N328 = neutron.hacking.checks:check_asserttruefalse
N329 = neutron.hacking.checks:check_assertitemsequal
N330 = neutron.hacking.checks:check_assertempty
N332 = neutron.hacking.checks:check_assertequal_for_httpcode
N340 = neutron.hacking.checks:check_oslo_i18n_wrapper
N341 = neutron.hacking.checks:check_builtins_gettext
N343 = neutron.hacking.checks:check_no_imports_from_tests
N344 = neutron.hacking.checks:check_python3_no_filter
N346 = neutron.hacking.checks:check_no_sqlalchemy_event_import
N348 = neutron.hacking.checks:check_no_import_six
N349 = neutron.hacking.checks:check_no_import_packaging
N350 = neutron.hacking.checks:check_no_sqlalchemy_lazy_subquery
# Checks from neutron-lib
N521 = neutron_lib.hacking.checks:use_jsonutils
N524 = neutron_lib.hacking.checks:check_no_contextlib_nested
N529 = neutron_lib.hacking.checks:no_mutable_default_args
N530 = neutron_lib.hacking.checks:check_neutron_namespace_imports
N532 = neutron_lib.hacking.translation_checks:check_log_warn_deprecated
N534 = neutron_lib.hacking.translation_checks:check_raised_localized_exceptions
N535 = neutron_lib.hacking.checks:check_no_eventlet_imports
N536 = neutron_lib.hacking.checks:assert_equal_none
N537 = neutron_lib.hacking.translation_checks:no_translate_logs
N322 = checks:check_assert_called_once_with
N328 = checks:check_asserttruefalse
N329 = checks:check_assertitemsequal
N330 = checks:check_assertempty
N332 = checks:check_assertequal_for_httpcode
N340 = checks:check_oslo_i18n_wrapper
N341 = checks:check_builtins_gettext
N343 = checks:check_no_imports_from_tests
N344 = checks:check_python3_no_filter
N346 = checks:check_no_sqlalchemy_event_import
N348 = checks:check_no_import_six
N349 = checks:check_no_import_packaging
N350 = checks:check_no_sqlalchemy_lazy_subquery
paths = ./neutron/hacking
[doc8]
max-line-length = 79