linter: Catch all malformatted string formatting clauses.

This also catches code like `"foo%s"%('bar')`, whereas before,
the first tuple entry could not be a string.
This commit is contained in:
Robert Hönig
2017-09-26 15:21:43 +02:00
committed by Tim Abbott
parent 83eb22fc2f
commit 48696ac9a1

View File

@@ -191,9 +191,9 @@ def build_custom_checkers(by_lang):
python_rules = cast(RuleList, [ python_rules = cast(RuleList, [
{'pattern': '^(?!#)@login_required', {'pattern': '^(?!#)@login_required',
'description': '@login_required is unsupported; use @zulip_login_required'}, 'description': '@login_required is unsupported; use @zulip_login_required'},
{'pattern': '".*"%\([a-z_].*\)?$', {'pattern': '".*"%\(.*\)?$',
'description': 'Missing space around "%"'}, 'description': 'Missing space around "%"'},
{'pattern': "'.*'%\([a-z_].*\)?$", {'pattern': "'.*'%\(.*\)?$",
'exclude': set(['analytics/lib/counts.py', 'exclude': set(['analytics/lib/counts.py',
'analytics/tests/test_counts.py', 'analytics/tests/test_counts.py',
]), ]),