From 6869f4d5bd0a9815cf6c5f8ac8b36af1c858d957 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 29 Aug 2025 22:52:49 +0900 Subject: [PATCH] Drop hacking check for old code structure The designate.openstack.common module was removed long time ago (in 4.0.0 release), and checking usage of the removed module is just useless. Change-Id: I7d46f2867da6ecbefd7e7823397f964f52075f40 Signed-off-by: Takashi Kajinami --- designate/hacking/checks.py | 26 -------------------------- tox.ini | 1 - 2 files changed, 27 deletions(-) diff --git a/designate/hacking/checks.py b/designate/hacking/checks.py index 4bdd18f16..161a2350e 100644 --- a/designate/hacking/checks.py +++ b/designate/hacking/checks.py @@ -17,9 +17,7 @@ import re from hacking import core # D701: Default parameter value is a mutable type -# D702: Log messages require translation # D703: Found use of _() without explicit import of _! -# D704: Found import of %s. This oslo library has been graduated! # D705: timeutils.utcnow() must be used instead of datetime.%s() # D706: Don't translate debug level logs # D707: basestring is not Python3-compatible, use str instead. @@ -40,10 +38,6 @@ translated_log = re.compile( underscore_import_check = re.compile(r"(.)*import _(.)*") # We need this for cases where they have created their own _ function. custom_underscore_check = re.compile(r"(.)*_\s*=\s*(.)*") -graduated_oslo_libraries_import_re = re.compile( - r"^\s*(?:import|from) designate\.openstack\.common\.?.*?" - r"(gettextutils|rpc)" - r".*?") no_line_continuation_backslash_re = re.compile(r'.*(\\)\n') @@ -92,26 +86,6 @@ def check_explicit_underscore_import(logical_line, filename): yield (0, "D703: Found use of _() without explicit import of _!") -@core.flake8ext -def no_import_graduated_oslo_libraries(logical_line, filename): - """Check that we don't continue to use o.c. oslo libraries after graduation - - After a library graduates from oslo-incubator, as we make the switch, we - should ensure we don't continue to use the oslo-incubator versions. - - In many cases, it's not possible to immediately remove the code from the - openstack/common folder due to dependency issues. - """ - # We can't modify oslo-incubator code, so ignore it here. - if "designate/openstack/common" in filename: - return - - matches = graduated_oslo_libraries_import_re.match(logical_line) - if matches: - yield (0, "D704: Found import of %s. This oslo library has been " - "graduated!" % matches.group(1)) - - @core.flake8ext def use_timeutils_utcnow(logical_line, filename): # tools are OK to use the standard datetime module diff --git a/tox.ini b/tox.ini index 2fd6801c2..f8bb0485d 100644 --- a/tox.ini +++ b/tox.ini @@ -174,7 +174,6 @@ import_exceptions = designate.i18n extension = D701 = checks:mutable_default_arguments D703 = checks:check_explicit_underscore_import - D704 = checks:no_import_graduated_oslo_libraries D705 = checks:use_timeutils_utcnow D706 = checks:no_translate_debug_logs D707 = checks:check_no_basestring