lint: Ban i18n usage under zerver/views/development.

This commit is contained in:
Tim Abbott
2019-05-15 13:09:51 -07:00
parent bae8295c52
commit 7f2fcea794

View File

@@ -513,7 +513,7 @@ def build_custom_checkers(by_lang):
'good_lines': [' from typing import List'], 'good_lines': [' from typing import List'],
'bad_lines': ['from typing import List']}, 'bad_lines': ['from typing import List']},
{'pattern': 'django.utils.translation', {'pattern': 'django.utils.translation',
'include_only': set(['test/']), 'include_only': set(['test/', 'zerver/views/development']),
'description': 'Test strings should not be tagged for translation', 'description': 'Test strings should not be tagged for translation',
'good_lines': [''], 'good_lines': [''],
'bad_lines': ['django.utils.translation']}, 'bad_lines': ['django.utils.translation']},
@@ -526,7 +526,7 @@ def build_custom_checkers(by_lang):
'good_lines': ['return json_success()'], 'good_lines': ['return json_success()'],
'bad_lines': ['return json_success({})']}, 'bad_lines': ['return json_success({})']},
{'pattern': r'\Wjson_error\(_\(?\w+\)', {'pattern': r'\Wjson_error\(_\(?\w+\)',
'exclude': set(['zerver/tests']), 'exclude': set(['zerver/tests', 'zerver/views/development']),
'description': 'Argument to json_error should be a literal string enclosed by _()', 'description': 'Argument to json_error should be a literal string enclosed by _()',
'good_lines': ['return json_error(_("string"))'], 'good_lines': ['return json_error(_("string"))'],
'bad_lines': ['return json_error(_variable)', 'return json_error(_(variable))']}, 'bad_lines': ['return json_error(_variable)', 'return json_error(_(variable))']},
@@ -535,10 +535,10 @@ def build_custom_checkers(by_lang):
'description': 'Argument to json_error should a literal string enclosed by _()'}, 'description': 'Argument to json_error should a literal string enclosed by _()'},
# To avoid JsonableError(_variable) and JsonableError(_(variable)) # To avoid JsonableError(_variable) and JsonableError(_(variable))
{'pattern': r'\WJsonableError\(_\(?\w.+\)', {'pattern': r'\WJsonableError\(_\(?\w.+\)',
'exclude': set(['zerver/tests']), 'exclude': set(['zerver/tests', 'zerver/views/development']),
'description': 'Argument to JsonableError should be a literal string enclosed by _()'}, 'description': 'Argument to JsonableError should be a literal string enclosed by _()'},
{'pattern': r'''\WJsonableError\(["'].+\)''', {'pattern': r'''\WJsonableError\(["'].+\)''',
'exclude': set(['zerver/tests']), 'exclude': set(['zerver/tests', 'zerver/views/development']),
'description': 'Argument to JsonableError should be a literal string enclosed by _()'}, 'description': 'Argument to JsonableError should be a literal string enclosed by _()'},
{'pattern': r"""\b_\((?:\s|{}|{})*[^\s'")]""".format(PYSQ, PYDQ), {'pattern': r"""\b_\((?:\s|{}|{})*[^\s'")]""".format(PYSQ, PYDQ),
'description': 'Called _() on a computed string', 'description': 'Called _() on a computed string',