mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 23:43:43 +00:00
linter: Fix include_only rule path comparison.
In order for the `include_only` linter rule to not have any side effects, we need to explicitly add a trailing '/' after every directory we want to include.
This commit is contained in:
@@ -58,7 +58,6 @@ def build_custom_checkers(by_lang):
|
|||||||
if line_fully_stripped in exclude_lines:
|
if line_fully_stripped in exclude_lines:
|
||||||
exclude_lines.remove(line_fully_stripped)
|
exclude_lines.remove(line_fully_stripped)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
line_to_check = line_fully_stripped
|
line_to_check = line_fully_stripped
|
||||||
if rule.get('strip') is not None:
|
if rule.get('strip') is not None:
|
||||||
@@ -150,7 +149,7 @@ def build_custom_checkers(by_lang):
|
|||||||
'static/js/debug.js']),
|
'static/js/debug.js']),
|
||||||
'description': 'console.log and similar should not be used in webapp'},
|
'description': 'console.log and similar should not be used in webapp'},
|
||||||
{'pattern': 'i18n[.]t',
|
{'pattern': 'i18n[.]t',
|
||||||
'include_only': set(['static/js/portico']),
|
'include_only': set(['static/js/portico/']),
|
||||||
'description': 'i18n.t is not available in portico pages yet'},
|
'description': 'i18n.t is not available in portico pages yet'},
|
||||||
{'pattern': '[.]text\(["\'][a-zA-Z]',
|
{'pattern': '[.]text\(["\'][a-zA-Z]',
|
||||||
'description': 'Strings passed to $().text should be wrapped in i18n.t() for internationalization'},
|
'description': 'Strings passed to $().text should be wrapped in i18n.t() for internationalization'},
|
||||||
@@ -223,7 +222,7 @@ def build_custom_checkers(by_lang):
|
|||||||
{'pattern': '.*%s.* % \([a-zA-Z0-9_.]*\)$',
|
{'pattern': '.*%s.* % \([a-zA-Z0-9_.]*\)$',
|
||||||
'description': 'Used % comprehension without a tuple'},
|
'description': 'Used % comprehension without a tuple'},
|
||||||
{'pattern': 'django.utils.translation',
|
{'pattern': 'django.utils.translation',
|
||||||
'include_only': set(['test']),
|
'include_only': set(['test/']),
|
||||||
'description': 'Test strings should not be tagged for translationx'},
|
'description': 'Test strings should not be tagged for translationx'},
|
||||||
{'pattern': 'json_success\({}\)',
|
{'pattern': 'json_success\({}\)',
|
||||||
'description': 'Use json_success() to return nothing'},
|
'description': 'Use json_success() to return nothing'},
|
||||||
|
|||||||
Reference in New Issue
Block a user