mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
lint: Lint against calls to _() on computed strings.
These don't actually work from an i18n perspective. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
committed by
Tim Abbott
parent
9a9de156c3
commit
122ad5be58
@@ -540,6 +540,13 @@ def build_custom_checkers(by_lang):
|
|||||||
{'pattern': r'''\WJsonableError\(["'].+\)''',
|
{'pattern': r'''\WJsonableError\(["'].+\)''',
|
||||||
'exclude': set(['zerver/tests']),
|
'exclude': set(['zerver/tests']),
|
||||||
'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),
|
||||||
|
'description': 'Called _() on a computed string',
|
||||||
|
'exclude_line': set([
|
||||||
|
('zerver/lib/i18n.py', 'result = _(string)'),
|
||||||
|
]),
|
||||||
|
'good_lines': ["return json_error(_('No presence data for %s') % (target.email,))"],
|
||||||
|
'bad_lines': ["return json_error(_('No presence data for %s' % (target.email,)))"]},
|
||||||
{'pattern': r'''([a-zA-Z0-9_]+)=REQ\(['"]\1['"]''',
|
{'pattern': r'''([a-zA-Z0-9_]+)=REQ\(['"]\1['"]''',
|
||||||
'description': 'REQ\'s first argument already defaults to parameter name'},
|
'description': 'REQ\'s first argument already defaults to parameter name'},
|
||||||
{'pattern': r'self\.client\.(get|post|patch|put|delete)',
|
{'pattern': r'self\.client\.(get|post|patch|put|delete)',
|
||||||
|
|||||||
Reference in New Issue
Block a user