From d1f6c22cb07f76a2ce1a847824dcb62b5a22e2e3 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 29 Aug 2025 01:57:07 +0900 Subject: [PATCH] Disable flake8 plugins by default Since 9b6a1aafc394df6e29cde3534167e53279f727f6 was merged, all plugins provided by neutron-lib are enabled automatically, as long as neutron-lib is enabled. This is a breaking change for any projects using neutron-lib, especially ones outside of neutron's governance. While technically we can ignore these checks, it'd be better to explicitly opt-in to these checks to make sure new checks do not break pep8 check immediately. Closes-Bug: #2121609 Change-Id: I3a592f6170ab5215c1e0f2ebd7b9778141689932 Signed-off-by: Takashi Kajinami --- neutron_lib/hacking/checks.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/neutron_lib/hacking/checks.py b/neutron_lib/hacking/checks.py index a40d204d2..171ca34e3 100644 --- a/neutron_lib/hacking/checks.py +++ b/neutron_lib/hacking/checks.py @@ -43,6 +43,7 @@ assert_is_none_re = re.compile( r"assertIs(Not)?\(.*,\s+None\)(( |\t)*#.*)?$|assertIs(Not)?\(None,") +@core.off_by_default @core.flake8ext def use_jsonutils(logical_line, filename): """N521 - jsonutils must be used instead of json. @@ -108,6 +109,7 @@ def _check_namespace_imports(failure_code, namespace, new_ns, logical_line, return (0, msg_o or msg) +@core.off_by_default @core.flake8ext def check_no_contextlib_nested(logical_line, filename): """N524 - Use of contextlib.nested is deprecated. @@ -127,6 +129,7 @@ def check_no_contextlib_nested(logical_line, filename): yield (0, msg) +@core.off_by_default @core.flake8ext def no_mutable_default_args(logical_line): """N529 - Method's default argument shouldn't be mutable. @@ -144,6 +147,7 @@ def no_mutable_default_args(logical_line): # Chances are that most projects will need to put an ignore on this rule # until they can fully migrate to the lib. +@core.off_by_default @core.flake8ext def check_neutron_namespace_imports(logical_line): """N530 - Direct neutron imports not allowed. @@ -160,6 +164,7 @@ def check_neutron_namespace_imports(logical_line): yield x +@core.off_by_default @core.flake8ext def check_no_eventlet_imports(logical_line): """N535 - Usage of Python eventlet module not allowed. @@ -174,6 +179,7 @@ def check_no_eventlet_imports(logical_line): yield logical_line.index('eventlet'), msg +@core.off_by_default @core.flake8ext def assert_equal_none(logical_line): """N536 - Use assertIsNone."""