Merge "Update hacking"
This commit is contained in:
@@ -15,7 +15,6 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from hacking import core
|
from hacking import core
|
||||||
import pycodestyle
|
|
||||||
|
|
||||||
# D701: Default parameter value is a mutable type
|
# D701: Default parameter value is a mutable type
|
||||||
# D702: Log messages require translation
|
# D702: Log messages require translation
|
||||||
@@ -49,8 +48,8 @@ no_line_continuation_backslash_re = re.compile(r'.*(\\)\n')
|
|||||||
|
|
||||||
|
|
||||||
@core.flake8ext
|
@core.flake8ext
|
||||||
def mutable_default_arguments(physical_line, logical_line, filename):
|
def mutable_default_arguments(logical_line, filename, noqa):
|
||||||
if pycodestyle.noqa(physical_line):
|
if noqa:
|
||||||
return
|
return
|
||||||
|
|
||||||
if mutable_default_argument_check.match(logical_line):
|
if mutable_default_argument_check.match(logical_line):
|
||||||
@@ -69,7 +68,7 @@ def no_translate_debug_logs(logical_line, filename):
|
|||||||
N319
|
N319
|
||||||
"""
|
"""
|
||||||
if logical_line.startswith("LOG.debug(_("):
|
if logical_line.startswith("LOG.debug(_("):
|
||||||
yield(0, "D706: Don't translate debug level logs")
|
yield (0, "D706: Don't translate debug level logs")
|
||||||
|
|
||||||
|
|
||||||
@core.flake8ext
|
@core.flake8ext
|
||||||
@@ -90,7 +89,7 @@ def check_explicit_underscore_import(logical_line, filename):
|
|||||||
UNDERSCORE_IMPORT_FILES.append(filename)
|
UNDERSCORE_IMPORT_FILES.append(filename)
|
||||||
elif (translated_log.match(logical_line) or
|
elif (translated_log.match(logical_line) or
|
||||||
string_translation.match(logical_line)):
|
string_translation.match(logical_line)):
|
||||||
yield(0, "D703: Found use of _() without explicit import of _!")
|
yield (0, "D703: Found use of _() without explicit import of _!")
|
||||||
|
|
||||||
|
|
||||||
@core.flake8ext
|
@core.flake8ext
|
||||||
@@ -109,8 +108,8 @@ def no_import_graduated_oslo_libraries(logical_line, filename):
|
|||||||
|
|
||||||
matches = graduated_oslo_libraries_import_re.match(logical_line)
|
matches = graduated_oslo_libraries_import_re.match(logical_line)
|
||||||
if matches:
|
if matches:
|
||||||
yield(0, "D704: Found import of %s. This oslo library has been "
|
yield (0, "D704: Found import of %s. This oslo library has been "
|
||||||
"graduated!" % matches.group(1))
|
"graduated!" % matches.group(1))
|
||||||
|
|
||||||
|
|
||||||
@core.flake8ext
|
@core.flake8ext
|
||||||
@@ -133,14 +132,13 @@ def check_no_basestring(logical_line):
|
|||||||
if re.search(r"\bbasestring\b", logical_line):
|
if re.search(r"\bbasestring\b", logical_line):
|
||||||
msg = ("D707: basestring is not Python3-compatible, use "
|
msg = ("D707: basestring is not Python3-compatible, use "
|
||||||
"str instead.")
|
"str instead.")
|
||||||
yield(0, msg)
|
yield (0, msg)
|
||||||
|
|
||||||
|
|
||||||
@core.flake8ext
|
@core.flake8ext
|
||||||
def check_python3_xrange(logical_line):
|
def check_python3_xrange(logical_line):
|
||||||
if re.search(r"\bxrange\s*\(", logical_line):
|
if re.search(r"\bxrange\s*\(", logical_line):
|
||||||
yield(0, "D708: Do not use xrange. Use range for "
|
yield (0, "D708: Do not use xrange. Use range for large loops.")
|
||||||
"large loops.")
|
|
||||||
|
|
||||||
|
|
||||||
@core.flake8ext
|
@core.flake8ext
|
||||||
@@ -152,7 +150,7 @@ def check_no_log_audit(logical_line):
|
|||||||
for OpenStack we can enforce not using it.
|
for OpenStack we can enforce not using it.
|
||||||
"""
|
"""
|
||||||
if "LOG.audit(" in logical_line:
|
if "LOG.audit(" in logical_line:
|
||||||
yield(0, "D709: LOG.audit is deprecated, please use LOG.info!")
|
yield (0, "D709: LOG.audit is deprecated, please use LOG.info!")
|
||||||
|
|
||||||
|
|
||||||
@core.flake8ext
|
@core.flake8ext
|
||||||
@@ -162,7 +160,7 @@ def check_no_log_warn(logical_line):
|
|||||||
D710
|
D710
|
||||||
"""
|
"""
|
||||||
if logical_line.startswith('LOG.warn('):
|
if logical_line.startswith('LOG.warn('):
|
||||||
yield(0, "D710:Use LOG.warning() rather than LOG.warn()")
|
yield (0, "D710:Use LOG.warning() rather than LOG.warn()")
|
||||||
|
|
||||||
|
|
||||||
@core.flake8ext
|
@core.flake8ext
|
||||||
|
@@ -89,9 +89,8 @@ class DesignateLimit(base.BaseDnsV2Test):
|
|||||||
'are {}: '.format(existing_project_ids))
|
'are {}: '.format(existing_project_ids))
|
||||||
all_project_limits = self.admin_client.list_designate_limits(
|
all_project_limits = self.admin_client.list_designate_limits(
|
||||||
headers={'x-auth-all-projects': True})
|
headers={'x-auth-all-projects': True})
|
||||||
LOG.info(
|
LOG.info('Retrieved designate limits by Admin user for all projects '
|
||||||
'Retrieved designate limits by Admin user for all projects '
|
'are: %s', all_project_limits)
|
||||||
'are: '.format(all_project_limits))
|
|
||||||
received_project_ids = [
|
received_project_ids = [
|
||||||
item['project_id'] for item in all_project_limits]
|
item['project_id'] for item in all_project_limits]
|
||||||
for project_id in existing_project_ids:
|
for project_id in existing_project_ids:
|
||||||
|
@@ -340,8 +340,7 @@ class ZonesImportTest(BaseZonesImportTest):
|
|||||||
self.assertIn(
|
self.assertIn(
|
||||||
zone_import['id'], listed_zone_import_ids,
|
zone_import['id'], listed_zone_import_ids,
|
||||||
"Failed, expected import ID:{} wasn't found in "
|
"Failed, expected import ID:{} wasn't found in "
|
||||||
"listed import IDs".format(
|
"listed import IDs".format(zone_import['id']))
|
||||||
zone_import['id'], listed_zone_import_ids))
|
|
||||||
|
|
||||||
# Test RBAC with x-auth-all-projects
|
# Test RBAC with x-auth-all-projects
|
||||||
expected_allowed = ['os_admin']
|
expected_allowed = ['os_admin']
|
||||||
|
@@ -3,4 +3,4 @@
|
|||||||
# process, which may cause wedges in the gate later.
|
# process, which may cause wedges in the gate later.
|
||||||
|
|
||||||
# Hacking already pins down pep8/pycodestyle pyflakes and flake8
|
# Hacking already pins down pep8/pycodestyle pyflakes and flake8
|
||||||
hacking>=3.0.1,<3.1.0 # Apache-2.0
|
hacking>=6.1.0,<6.2.0 # Apache-2.0
|
||||||
|
@@ -19,7 +19,7 @@ import linecache
|
|||||||
from prettytable import PrettyTable
|
from prettytable import PrettyTable
|
||||||
|
|
||||||
PEP8_LINE = r'^((?P<file>.*):(?P<line>\d*):(?P<col>\d*):) ' \
|
PEP8_LINE = r'^((?P<file>.*):(?P<line>\d*):(?P<col>\d*):) ' \
|
||||||
'(?P<error>(?P<error_code>\w\d{1,3})(?P<error_desc>.*$))'
|
r'(?P<error>(?P<error_code>\w\d{1,3})(?P<error_desc>.*$))'
|
||||||
|
|
||||||
HTML = True
|
HTML = True
|
||||||
|
|
||||||
|
5
tox.ini
5
tox.ini
@@ -100,8 +100,9 @@ extension =
|
|||||||
T108 = tempest.hacking.checks:no_hyphen_at_end_of_rand_name
|
T108 = tempest.hacking.checks:no_hyphen_at_end_of_rand_name
|
||||||
N322 = tempest.hacking.checks:no_mutable_default_args
|
N322 = tempest.hacking.checks:no_mutable_default_args
|
||||||
T109 = tempest.hacking.checks:no_testtools_skip_decorator
|
T109 = tempest.hacking.checks:no_testtools_skip_decorator
|
||||||
T110 = tempest.hacking.checks:get_resources_on_service_clients
|
# TODO(johnsom) Re-enable these once tempest updates hacking to > 3.1.0
|
||||||
T111 = tempest.hacking.checks:delete_resources_on_service_clients
|
# T110 = tempest.hacking.checks:get_resources_on_service_clients
|
||||||
|
# T111 = tempest.hacking.checks:delete_resources_on_service_clients
|
||||||
T112 = tempest.hacking.checks:dont_import_local_tempest_into_lib
|
T112 = tempest.hacking.checks:dont_import_local_tempest_into_lib
|
||||||
T113 = tempest.hacking.checks:dont_use_config_in_tempest_lib
|
T113 = tempest.hacking.checks:dont_use_config_in_tempest_lib
|
||||||
T114 = tempest.hacking.checks:use_rand_uuid_instead_of_uuid4
|
T114 = tempest.hacking.checks:use_rand_uuid_instead_of_uuid4
|
||||||
|
Reference in New Issue
Block a user