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:
Robert Hönig
2017-06-20 22:27:49 +02:00
committed by showell
parent a4afca7b73
commit fd41a481e4

View File

@@ -58,7 +58,6 @@ def build_custom_checkers(by_lang):
if line_fully_stripped in exclude_lines:
exclude_lines.remove(line_fully_stripped)
continue
try:
line_to_check = line_fully_stripped
if rule.get('strip') is not None:
@@ -150,7 +149,7 @@ def build_custom_checkers(by_lang):
'static/js/debug.js']),
'description': 'console.log and similar should not be used in webapp'},
{'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'},
{'pattern': '[.]text\(["\'][a-zA-Z]',
'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_.]*\)$',
'description': 'Used % comprehension without a tuple'},
{'pattern': 'django.utils.translation',
'include_only': set(['test']),
'include_only': set(['test/']),
'description': 'Test strings should not be tagged for translationx'},
{'pattern': 'json_success\({}\)',
'description': 'Use json_success() to return nothing'},