Remove log translations and hacking

Log translation is no longer used, remove translate functions

Change-Id: Ibe205266debd6d39dab0a652a327ab19081ff27a
This commit is contained in:
Ngo Quoc Cuong
2017-05-23 16:12:26 +07:00
parent 32dacdca8b
commit 17aa1122da
3 changed files with 2 additions and 34 deletions

View File

@@ -15,8 +15,6 @@
import os
import re
import pep8
def flake8ext(f):
"""Decorator to indicate flake8 extension.
@@ -58,29 +56,12 @@ def _regex_for_level(level, hint):
}
log_translation_hint = re.compile(
'|'.join('(?:%s)' % _regex_for_level(level, hint)
for level, hint in _all_log_levels.items()))
log_warn = re.compile(
r"(.)*LOG\.(warn)\(\s*('|\"|_)")
unittest_imports_dot = re.compile(r"\bimport[\s]+unittest\b")
unittest_imports_from = re.compile(r"\bfrom[\s]+unittest\b")
@flake8ext
def validate_log_translations(logical_line, physical_line, filename):
# Translations are not required in the test directory
if "watcher/tests" in filename:
return
if pep8.noqa(physical_line):
return
msg = "N320: Log messages require translation hints!"
if log_translation_hint.match(logical_line):
yield (0, msg)
@flake8ext
def use_jsonutils(logical_line, filename):
msg = "N321: jsonutils.%(fun)s must be used instead of json.%(fun)s"
@@ -291,7 +272,6 @@ def check_builtins_gettext(logical_line, tokens, filename, lines, noqa):
def factory(register):
register(validate_log_translations)
register(use_jsonutils)
register(check_assert_called_once_with)
register(no_translate_debug_logs)