Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which supports Python 3. Update local hacking checks for new flake8. Ignore new warnings, they will be fixed in followup. Remove hacking and friends from lower-constraints, they are not needed to be installed at run-time. Add Pygments to lower-constraints to pass requirements-check. Change-Id: I20da1309e4d65707130fe517f013d3ed625bf94c
This commit is contained in:
parent
ab69088d04
commit
a27dc56f52
@ -15,6 +15,8 @@
|
||||
|
||||
import re
|
||||
|
||||
from hacking import core
|
||||
|
||||
|
||||
"""
|
||||
Guidelines for writing new hacking checks
|
||||
@ -31,6 +33,7 @@ Guidelines for writing new hacking checks
|
||||
"""
|
||||
|
||||
|
||||
@core.flake8ext
|
||||
def no_log_warn(logical_line):
|
||||
"""Disallow 'LOG.warn('
|
||||
|
||||
@ -42,6 +45,7 @@ def no_log_warn(logical_line):
|
||||
yield(0, 'Heat301 Use LOG.warning() rather than LOG.warn()')
|
||||
|
||||
|
||||
@core.flake8ext
|
||||
def check_python3_no_iteritems(logical_line):
|
||||
msg = ("Heat302: Use dict.items() instead of dict.iteritems().")
|
||||
|
||||
@ -49,6 +53,7 @@ def check_python3_no_iteritems(logical_line):
|
||||
yield(0, msg)
|
||||
|
||||
|
||||
@core.flake8ext
|
||||
def check_python3_no_iterkeys(logical_line):
|
||||
msg = ("Heat303: Use dict.keys() instead of dict.iterkeys().")
|
||||
|
||||
@ -56,15 +61,9 @@ def check_python3_no_iterkeys(logical_line):
|
||||
yield(0, msg)
|
||||
|
||||
|
||||
@core.flake8ext
|
||||
def check_python3_no_itervalues(logical_line):
|
||||
msg = ("Heat304: Use dict.values() instead of dict.itervalues().")
|
||||
|
||||
if re.search(r".*\.itervalues\(\)", logical_line):
|
||||
yield(0, msg)
|
||||
|
||||
|
||||
def factory(register):
|
||||
register(no_log_warn)
|
||||
register(check_python3_no_iteritems)
|
||||
register(check_python3_no_iterkeys)
|
||||
register(check_python3_no_itervalues)
|
||||
|
@ -28,13 +28,11 @@ eventlet==0.18.2
|
||||
extras==1.0.0
|
||||
fasteners==0.14.1
|
||||
fixtures==3.0.0
|
||||
flake8==2.5.5
|
||||
future==0.16.0
|
||||
futurist==1.6.0
|
||||
gitdb2==2.0.3
|
||||
GitPython==2.1.8
|
||||
greenlet==0.4.13
|
||||
hacking==0.12.0
|
||||
idna==2.6
|
||||
iso8601==0.1.12
|
||||
Jinja2==2.10
|
||||
@ -84,7 +82,6 @@ paramiko==2.4.1
|
||||
Paste==2.0.3
|
||||
PasteDeploy==1.5.0
|
||||
pbr==2.0.0
|
||||
pep8==1.5.7
|
||||
pika-pool==0.1.3
|
||||
pika==0.10.0
|
||||
ply==3.11
|
||||
@ -94,7 +91,6 @@ psycopg2==2.7
|
||||
pyasn1==0.4.2
|
||||
pycadf==2.7.0
|
||||
pycparser==2.18
|
||||
pyflakes==0.8.1
|
||||
Pygments==2.2.0
|
||||
pyinotify==0.9.6
|
||||
PyMySQL==0.7.6
|
||||
|
@ -3,7 +3,7 @@
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
# Hacking already pins down pep8, pyflakes and flake8
|
||||
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
|
||||
hacking>=3.0,<3.1.0 # Apache-2.0
|
||||
bandit!=1.6.0,>=1.1.0 # Apache-2.0
|
||||
coverage!=4.4,>=4.0 # Apache-2.0
|
||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||
|
24
tox.ini
24
tox.ini
@ -108,8 +108,21 @@ commands = bandit -r heat -x tests --skip B101,B104,B107,B110,B310,B311,B404,B41
|
||||
|
||||
[flake8]
|
||||
show-source = true
|
||||
# E117 over-indented
|
||||
# E123 closing bracket does not match indentation of opening bracket's line
|
||||
# E226 missing whitespace around arithmetic operator
|
||||
# E241 multiple spaces after ','
|
||||
# E305 expected 2 blank lines after class or function definition, found 1
|
||||
# E402 module level import not at top of file
|
||||
# E731 do not assign a lambda expression, use a def
|
||||
# E741 ambiguous variable name 'l'
|
||||
# F841 local variable 'ex' is assigned to but never used
|
||||
# W503 line break before binary operator
|
||||
# W504 line break after binary operator
|
||||
# W605 invalid escape sequence '\ '
|
||||
ignore = E117,E123,E226,E241,E305,E402,E731,E741,F841,W503,W504,W605
|
||||
exclude=.*,dist,*lib/python*,*egg,build,*convergence/scenarios/*
|
||||
max-complexity=20
|
||||
max-complexity=23
|
||||
|
||||
[doc8]
|
||||
ignore = D001
|
||||
@ -117,7 +130,14 @@ ignore-path = .venv,.git,.tox,.tmp,*heat/locale*,*lib/python*,openstack_heat.egg
|
||||
|
||||
[hacking]
|
||||
import_exceptions = heat.common.i18n
|
||||
local-check-factory = heat.hacking.checks.factory
|
||||
|
||||
[flake8:local-plugins]
|
||||
extension =
|
||||
Heat301 = checks:no_log_warn
|
||||
Heat302 = checks:check_python3_no_iteritems
|
||||
Heat303 = checks:check_python3_no_iterkeys
|
||||
Heat304 = checks:check_python3_no_itervalues
|
||||
paths = ./heat/hacking
|
||||
|
||||
[testenv:debug]
|
||||
commands = oslo_debug_helper {posargs}
|
||||
|
Loading…
Reference in New Issue
Block a user