mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
lint: Remove custom rules duplicating eslint and pycodestyle.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
b0d632577f
commit
d49e880c09
@@ -117,8 +117,6 @@ js_rules = RuleList(
|
||||
'description': 'Avoid using "msgid" as a variable name; use "message_id" instead.'},
|
||||
{'pattern': r'.*blueslip.warning\(.*',
|
||||
'description': 'The module blueslip has no function warning, try using blueslip.warn'},
|
||||
{'pattern': '[)]{$',
|
||||
'description': 'Missing space between ) and {'},
|
||||
{'pattern': r'i18n\.t\([^)]+[^,\{\)]$',
|
||||
'description': 'i18n string should not be a multiline string'},
|
||||
{'pattern': r'''i18n\.t\(['"].+?['"]\s*\+''',
|
||||
@@ -139,18 +137,8 @@ js_rules = RuleList(
|
||||
{'pattern': '["\']json/',
|
||||
'description': 'Relative URL for JSON route not supported by i18n'},
|
||||
# This rule is constructed with + to avoid triggering on itself
|
||||
{'pattern': " =" + '[^ =>~"]',
|
||||
'description': 'Missing whitespace after "="'},
|
||||
{'pattern': '^[ ]*//[A-Za-z0-9]',
|
||||
'description': 'Missing space after // in comment'},
|
||||
{'pattern': 'if[(]',
|
||||
'description': 'Missing space between if and ('},
|
||||
{'pattern': 'else{$',
|
||||
'description': 'Missing space between else and {'},
|
||||
{'pattern': '^else {$',
|
||||
'description': 'Write JS else statements on same line as }'},
|
||||
{'pattern': '^else if',
|
||||
'description': 'Write JS else statements on same line as }'},
|
||||
{'pattern': r'''[.]text\(["'][a-zA-Z]''',
|
||||
'description': 'Strings passed to $().text should be wrapped in i18n.t() for internationalization',
|
||||
'exclude': {'frontend_tests/node_tests/'}},
|
||||
@@ -231,32 +219,10 @@ python_rules = RuleList(
|
||||
'exclude': {'zerver/tests', 'zerver/lib/create_user.py'},
|
||||
'good_lines': ['user_profile.save(update_fields=["pointer"])'],
|
||||
'bad_lines': ['user_profile.save()']},
|
||||
{'pattern': r'^[^"]*"[^"]*"%\(',
|
||||
'description': 'Missing space around "%"',
|
||||
'good_lines': ['"%s" % ("foo")', '"%s" % (foo)'],
|
||||
'bad_lines': ['"%s"%("foo")', '"%s"%(foo)']},
|
||||
{'pattern': r"^[^']*'[^']*'%\(",
|
||||
'description': 'Missing space around "%"',
|
||||
'good_lines': ["'%s' % ('foo')", "'%s' % (foo)"],
|
||||
'bad_lines': ["'%s'%('foo')", "'%s'%(foo)"]},
|
||||
{'pattern': 'self: Any',
|
||||
'description': 'you can omit Any annotation for self',
|
||||
'good_lines': ['def foo (self):'],
|
||||
'bad_lines': ['def foo(self: Any):']},
|
||||
# This rule is constructed with + to avoid triggering on itself
|
||||
{'pattern': " =" + '[^ =>~"]',
|
||||
'description': 'Missing whitespace after "="',
|
||||
'good_lines': ['a = b', '5 == 6'],
|
||||
'bad_lines': ['a =b', 'asdf =42']},
|
||||
{'pattern': r'":\w[^"]*$',
|
||||
'description': 'Missing whitespace after ":"',
|
||||
'exclude': {'zerver/tests/test_push_notifications.py'},
|
||||
'good_lines': ['"foo": bar', '"some:string:with:colons"'],
|
||||
'bad_lines': ['"foo":bar', '"foo":1']},
|
||||
{'pattern': r"':\w[^']*$",
|
||||
'description': 'Missing whitespace after ":"',
|
||||
'good_lines': ["'foo': bar", "'some:string:with:colons'"],
|
||||
'bad_lines': ["'foo':bar", "'foo':1"]},
|
||||
{'pattern': r"^\s+#\w",
|
||||
'strip': '\n',
|
||||
'exclude': {'tools/droplets/create.py'},
|
||||
@@ -267,10 +233,6 @@ python_rules = RuleList(
|
||||
'description': 'Use assertEqual, not assertEquals (which is deprecated).',
|
||||
'good_lines': ['assertEqual(1, 2)'],
|
||||
'bad_lines': ['assertEquals(1, 2)']},
|
||||
{'pattern': "== None",
|
||||
'description': 'Use `is None` to check whether something is None',
|
||||
'good_lines': ['if foo is None'],
|
||||
'bad_lines': ['foo == None']},
|
||||
{'pattern': r"#\s*type:\s*ignore(?!\[[^][]+\] +# +\S)",
|
||||
'exclude': {'tools/tests',
|
||||
'zerver/lib/test_runner.py',
|
||||
|
||||
Reference in New Issue
Block a user