Bump hacking
hacking 3.0.x is too old. This also removes the note about old behavior of pip which has been changed in recent versions. Notes: - A few errors newly detected are also fixed. - This also fixes the compatibility with flake8 >= 3.0 because flake8 is also bumped when we bump hacking. Change-Id: I7fa87ed77bb39945ee5464692b7ef3d25c046127
This commit is contained in:
parent
732cd520d4
commit
7787fefa30
@ -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,14 @@ 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 +151,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 +161,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
|
||||||
|
@ -2,9 +2,6 @@
|
|||||||
# date but we do not test them so no guarantee of having them all correct. If
|
# date but we do not test them so no guarantee of having them all correct. If
|
||||||
# you find any incorrect lower bounds, let us know or propose a fix.
|
# you find any incorrect lower bounds, let us know or propose a fix.
|
||||||
|
|
||||||
# The order of packages is significant, because pip processes them in the order
|
|
||||||
# of appearance. Changing the order has an impact on the overall integration
|
|
||||||
# process, which may cause wedges in the gate later.
|
|
||||||
cliff!=2.9.0,>=2.8.0 # Apache-2.0
|
cliff!=2.9.0,>=2.8.0 # Apache-2.0
|
||||||
jsonschema>=3.2.0 # MIT
|
jsonschema>=3.2.0 # MIT
|
||||||
osc-lib>=1.8.0 # Apache-2.0
|
osc-lib>=1.8.0 # Apache-2.0
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
# The order of packages is significant, because pip processes them in the order
|
|
||||||
# of appearance. Changing the order has an impact on the overall integration
|
|
||||||
# process, which may cause wedges in the gate later.
|
|
||||||
# Hacking already pins down pep8, pyflakes and flake8
|
# Hacking already pins down pep8, pyflakes and flake8
|
||||||
hacking>=3.0.1,<3.1.0 # Apache-2.0
|
hacking>=6.1.0,<6.2.0 # Apache-2.0
|
||||||
coverage!=4.4,>=4.0 # Apache-2.0
|
coverage!=4.4,>=4.0 # Apache-2.0
|
||||||
oslo.config>=5.2.0 # Apache-2.0
|
oslo.config>=5.2.0 # Apache-2.0
|
||||||
oslotest>=3.2.0 # Apache-2.0
|
oslotest>=3.2.0 # Apache-2.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user