Merge "Add hacking check D710 for LOG.warn()"

This commit is contained in:
Zuul 2021-12-03 07:25:51 +00:00 committed by Gerrit Code Review
commit aa798fc006
2 changed files with 12 additions and 0 deletions

View File

@ -26,6 +26,7 @@ import pycodestyle
# D707: basestring is not Python3-compatible, use str instead.
# D708: Do not use xrange. Use range for large loops.
# D709: LOG.audit is deprecated, please use LOG.info!
# D710: LOG.warn() is not allowed. Use LOG.warning()
UNDERSCORE_IMPORT_FILES = []
@ -150,3 +151,13 @@ def check_no_log_audit(logical_line):
"""
if "LOG.audit(" in logical_line:
yield(0, "D709: LOG.audit is deprecated, please use LOG.info!")
@core.flake8ext
def check_no_log_warn(logical_line):
"""Disallow 'LOG.warn('
D710
"""
if logical_line.startswith('LOG.warn('):
yield(0, "D710:Use LOG.warning() rather than LOG.warn()")

View File

@ -177,6 +177,7 @@ extension =
D707 = checks:check_no_basestring
D708 = checks:check_python3_xrange
D709 = checks:check_no_log_audit
D710 = checks:check_no_log_warn
paths = ./designate/hacking
[testenv:lower-constraints]