Merge "Disallow log hints in LOG.debug"
This commit is contained in:
commit
fd85a7ec3c
@ -144,7 +144,7 @@ def no_author_tags(physical_line):
|
|||||||
|
|
||||||
|
|
||||||
def no_translate_debug_logs(logical_line, filename):
|
def no_translate_debug_logs(logical_line, filename):
|
||||||
"""Check for 'LOG.debug(_('
|
"""Check for 'LOG.debug(_(' and 'LOG.debug(_Lx('
|
||||||
|
|
||||||
As per our translation policy,
|
As per our translation policy,
|
||||||
https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation
|
https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation
|
||||||
@ -154,7 +154,8 @@ def no_translate_debug_logs(logical_line, filename):
|
|||||||
N319
|
N319
|
||||||
"""
|
"""
|
||||||
if _directory_to_check_translation(filename):
|
if _directory_to_check_translation(filename):
|
||||||
if logical_line.startswith("LOG.debug(_("):
|
for hint in _all_hints:
|
||||||
|
if logical_line.startswith("LOG.debug(%s(" % hint):
|
||||||
yield(0, "N319 Don't translate debug level logs")
|
yield(0, "N319 Don't translate debug level logs")
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,6 +59,13 @@ class HackingTestCase(base.BaseTestCase):
|
|||||||
stmt,
|
stmt,
|
||||||
filename))))
|
filename))))
|
||||||
|
|
||||||
|
def test_no_translate_debug_logs(self):
|
||||||
|
filename = 'neutron/agent/f'
|
||||||
|
for hint in checks._all_hints:
|
||||||
|
bad = "LOG.debug(%s('bad'))" % hint
|
||||||
|
self.assertEqual(
|
||||||
|
1, len(list(checks.no_translate_debug_logs(bad, filename))))
|
||||||
|
|
||||||
def test_use_jsonutils(self):
|
def test_use_jsonutils(self):
|
||||||
def __get_msg(fun):
|
def __get_msg(fun):
|
||||||
msg = ("N321: jsonutils.%(fun)s must be used instead of "
|
msg = ("N321: jsonutils.%(fun)s must be used instead of "
|
||||||
|
Loading…
Reference in New Issue
Block a user