Merge "Hacking: Remove C306, C308 checks"

This commit is contained in:
Zuul 2024-02-21 16:00:04 +00:00 committed by Gerrit Code Review
commit 0425c08f3d
5 changed files with 1 additions and 27 deletions

View File

@ -13,8 +13,6 @@ Cinder Specific Commandments
datetime.now(). datetime.now().
- [C303] Ensure that there are no 'print()' statements are used in code that - [C303] Ensure that there are no 'print()' statements are used in code that
should be using LOG calls. should be using LOG calls.
- [C306] timeutils.strtime() must not be used (deprecated).
- [C308] timeutils.isotime() must not be used (deprecated).
- [C309] Unit tests should not perform logging. - [C309] Unit tests should not perform logging.
- [C310] Check for improper use of logging format arguments. - [C310] Check for improper use of logging format arguments.
- [C311] Check for proper naming and usage in option registration. - [C311] Check for proper naming and usage in option registration.

View File

@ -325,14 +325,6 @@ def check_no_print_statements(logical_line, filename, noqa):
yield(0, msg) yield(0, msg)
@core.flake8ext
def check_timeutils_strtime(logical_line):
msg = ("C306: Found timeutils.strtime(). "
"Please use datetime.datetime.isoformat() or datetime.strftime()")
if 'timeutils.strtime' in logical_line:
yield(0, msg)
@core.flake8ext @core.flake8ext
def dict_constructor_with_list_copy(logical_line): def dict_constructor_with_list_copy(logical_line):
msg = ("N336: Must use a dict comprehension instead of a dict constructor " msg = ("N336: Must use a dict comprehension instead of a dict constructor "
@ -341,14 +333,6 @@ def dict_constructor_with_list_copy(logical_line):
yield (0, msg) yield (0, msg)
@core.flake8ext
def check_timeutils_isotime(logical_line):
msg = ("C308: Found timeutils.isotime(). "
"Please use datetime.datetime.isoformat()")
if 'timeutils.isotime' in logical_line:
yield(0, msg)
@core.flake8ext @core.flake8ext
def no_test_log(logical_line, filename, noqa): def no_test_log(logical_line, filename, noqa):
if ('cinder/tests' not in filename or noqa): if ('cinder/tests' not in filename or noqa):

View File

@ -231,12 +231,6 @@ class HackingTestCase(test.TestCase):
self.assertEqual(0, len(list(checks.check_datetime_now( self.assertEqual(0, len(list(checks.check_datetime_now(
"datetime.now() # noqa", True)))) "datetime.now() # noqa", True))))
def test_check_timeutils_strtime(self):
self.assertEqual(1, len(list(checks.check_timeutils_strtime(
"timeutils.strtime"))))
self.assertEqual(0, len(list(checks.check_timeutils_strtime(
"strftime"))))
def test_no_print_statements(self): def test_no_print_statements(self):
self.assertEqual(0, len(list(checks.check_no_print_statements( self.assertEqual(0, len(list(checks.check_no_print_statements(
"a line with no print statement", "a line with no print statement",

View File

@ -27,7 +27,7 @@ oslo.rootwrap>=6.2.0 # Apache-2.0
oslo.serialization>=4.2.0 # Apache-2.0 oslo.serialization>=4.2.0 # Apache-2.0
oslo.service>=2.8.0 # Apache-2.0 oslo.service>=2.8.0 # Apache-2.0
oslo.upgradecheck>=1.1.1 # Apache-2.0 oslo.upgradecheck>=1.1.1 # Apache-2.0
oslo.utils>=4.12.1 # Apache-2.0 oslo.utils>=6.0.0 # Apache-2.0
oslo.versionedobjects>=2.4.0 # Apache-2.0 oslo.versionedobjects>=2.4.0 # Apache-2.0
osprofiler>=3.4.0 # Apache-2.0 osprofiler>=3.4.0 # Apache-2.0
packaging>=20.4 packaging>=20.4

View File

@ -263,8 +263,6 @@ extension =
N323 = checks:check_explicit_underscore_import N323 = checks:check_explicit_underscore_import
C301 = checks:check_datetime_now C301 = checks:check_datetime_now
C303 = checks:check_no_print_statements C303 = checks:check_no_print_statements
C306 = checks:check_timeutils_strtime
C308 = checks:check_timeutils_isotime
C309 = checks:no_test_log C309 = checks:no_test_log
C310 = checks:CheckLoggingFormatArgs C310 = checks:CheckLoggingFormatArgs
C311 = checks:CheckOptRegistrationArgs C311 = checks:CheckOptRegistrationArgs