Browse Source

Stop enforcing translations on logs

Translations team has stopped translating the logs. We need to
stop enforcing the usage of translation functions on logging.

Change-Id: I56900846ce8ea92eaa3873f64b383a36a4974908
tags/15.0.0.0b2
Erno Kuvaja 3 years ago
parent
commit
87a56ce5c7
2 changed files with 0 additions and 33 deletions
  1. +0
    -6
      HACKING.rst
  2. +0
    -27
      glance/hacking/checks.py

+ 0
- 6
HACKING.rst View File

@@ -16,12 +16,6 @@ glance Specific Commandments
assertIsNone(A)
- [G319] Validate that debug level logs are not translated
- [G320] For python 3 compatibility, use six.text_type() instead of unicode()
- [G321] Validate that LOG messages, except debug ones, have translations
- [G322] Validate that LOG.info messages use _LI.
- [G323] Validate that LOG.exception messages use _LE.
- [G324] Validate that LOG.error messages use _LE.
- [G325] Validate that LOG.critical messages use _LC.
- [G326] Validate that LOG.warning messages use _LW.
- [G327] Prevent use of deprecated contextlib.nested
- [G328] Must use a dict comprehension instead of a dict constructor with a sequence of key-value pairs
- [G329] Python 3: Do not use xrange.


+ 0
- 27
glance/hacking/checks.py View File

@@ -14,8 +14,6 @@

import re

import pep8

"""
Guidelines for writing new hacking checks

@@ -116,30 +114,6 @@ def no_direct_use_of_unicode_function(logical_line):
yield(0, "G320: Use six.text_type() instead of unicode()")


def validate_log_translations(logical_line, physical_line, filename):
# Translations are not required in the test directory
if pep8.noqa(physical_line):
return
msg = "G322: LOG.info messages require translations `_LI()`!"
if log_translation_info.match(logical_line):
yield (0, msg)
msg = "G323: LOG.exception messages require translations `_LE()`!"
if log_translation_exception.match(logical_line):
yield (0, msg)
msg = "G324: LOG.error messages require translations `_LE()`!"
if log_translation_error.match(logical_line):
yield (0, msg)
msg = "G325: LOG.critical messages require translations `_LC()`!"
if log_translation_critical.match(logical_line):
yield (0, msg)
msg = "G326: LOG.warning messages require translations `_LW()`!"
if log_translation_warning.match(logical_line):
yield (0, msg)
msg = "G321: Log messages require translations!"
if log_translation.match(logical_line):
yield (0, msg)


def check_no_contextlib_nested(logical_line):
msg = ("G327: contextlib.nested is deprecated since Python 2.7. See "
"https://docs.python.org/2/library/contextlib.html#contextlib."
@@ -189,7 +163,6 @@ def factory(register):
register(assert_equal_none)
register(no_translate_debug_logs)
register(no_direct_use_of_unicode_function)
register(validate_log_translations)
register(check_no_contextlib_nested)
register(dict_constructor_with_list_copy)
register(check_python3_xrange)


Loading…
Cancel
Save