Merge "flake8: Ensure local check in hacking 2.0.0"

This commit is contained in:
Zuul 2020-02-19 12:57:55 +00:00 committed by Gerrit Code Review
commit ddb9a8219e
2 changed files with 6 additions and 6 deletions

View File

@ -15,6 +15,8 @@
import re
from hacking import core
"""
Guidelines for writing new hacking checks
- Use only for Horizon specific tests. OpenStack general tests
@ -31,11 +33,8 @@ Guidelines for writing new hacking checks
mutable_default_args = re.compile(r"^\s*def .+\((.+=\{\}|.+=\[\])")
@core.flake8ext
def no_mutable_default_args(logical_line):
msg = "M322: Method's default argument shouldn't be mutable!"
if mutable_default_args.match(logical_line):
yield (0, msg)
def factory(register):
register(no_mutable_default_args)

View File

@ -186,8 +186,9 @@ max_line_length = 80
import-order-style = pep8
application-import-names = horizon,openstack_dashboard
[hacking]
local-check-factory = horizon.hacking.checks.factory
[flake8:local-plugins]
extension =
M322 = horizon.hacking.checks:no_mutable_default_args
[doc8]
# File extensions to check