lint: Upgrade zulint.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2020-04-18 15:47:39 -07:00 committed by Tim Abbott
parent ddb05ea7eb
commit 75d1fe2b41
3 changed files with 12 additions and 7 deletions

View file

@ -7,5 +7,5 @@ pytest
-e ./zulip -e ./zulip
-e ./zulip_bots -e ./zulip_bots
-e ./zulip_botserver -e ./zulip_botserver
-e git+https://github.com/zulip/zulint@aaed679f1ad38b230090eadd3870b7682500f60c#egg=zulint==1.0.0 -e git+https://github.com/zulip/zulint@8cb430b64eec1e98ef637bafd06272ebe715aa87#egg=zulint==1.0.0
mypy==0.770 mypy==0.770

View file

@ -13,7 +13,7 @@ whitespace_rules = [
{'pattern': '\t', {'pattern': '\t',
'strip': '\n', 'strip': '\n',
'description': 'Fix tab-based whitespace'}, 'description': 'Fix tab-based whitespace'},
] # type: Rule ] # type: List[Rule]
markdown_whitespace_rules = list([rule for rule in whitespace_rules if rule['pattern'] != r'\s+$']) + [ markdown_whitespace_rules = list([rule for rule in whitespace_rules if rule['pattern'] != r'\s+$']) + [
# Two spaces trailing a line with other content is okay--it's a markdown line break. # Two spaces trailing a line with other content is okay--it's a markdown line break.
@ -25,7 +25,7 @@ markdown_whitespace_rules = list([rule for rule in whitespace_rules if rule['pat
{'pattern': r'^#+[A-Za-z0-9]', {'pattern': r'^#+[A-Za-z0-9]',
'strip': '\n', 'strip': '\n',
'description': 'Missing space after # in heading'}, 'description': 'Missing space after # in heading'},
] # type: Rule ]
python_rules = RuleList( python_rules = RuleList(
langs=['py'], langs=['py'],
@ -90,7 +90,8 @@ python_rules = RuleList(
'bad_lines': ['class TestSomeBot(DefaultTests, BotTestCase):'], 'bad_lines': ['class TestSomeBot(DefaultTests, BotTestCase):'],
'good_lines': ['class TestSomeBot(BotTestCase, DefaultTests):'], 'good_lines': ['class TestSomeBot(BotTestCase, DefaultTests):'],
'description': 'Bot test cases should inherit from BotTestCase before DefaultTests.'}, 'description': 'Bot test cases should inherit from BotTestCase before DefaultTests.'},
] + whitespace_rules, *whitespace_rules,
],
max_length=140, max_length=140,
) )
@ -100,7 +101,8 @@ bash_rules = RuleList(
{'pattern': r'#!.*sh [-xe]', {'pattern': r'#!.*sh [-xe]',
'description': 'Fix shebang line with proper call to /usr/bin/env for Bash path, change -x|-e switches' 'description': 'Fix shebang line with proper call to /usr/bin/env for Bash path, change -x|-e switches'
' to set -x|set -e'}, ' to set -x|set -e'},
] + whitespace_rules[0:1], *whitespace_rules[0:1],
],
) )
@ -127,7 +129,7 @@ prose_style_rules = [
'description': "!!! warning is invalid; it's spelled '!!! warn'"}, 'description': "!!! warning is invalid; it's spelled '!!! warn'"},
{'pattern': r'[^-_]botserver(?!rc)|bot server', {'pattern': r'[^-_]botserver(?!rc)|bot server',
'description': "Use Botserver instead of botserver or Botserver."}, 'description': "Use Botserver instead of botserver or Botserver."},
] # type: Rule ] # type: List[Rule]
markdown_docs_length_exclude = { markdown_docs_length_exclude = {
"zulip_bots/zulip_bots/bots/converter/doc.md", "zulip_bots/zulip_bots/bots/converter/doc.md",
@ -135,7 +137,9 @@ markdown_docs_length_exclude = {
markdown_rules = RuleList( markdown_rules = RuleList(
langs=['md'], langs=['md'],
rules=markdown_whitespace_rules + prose_style_rules + [ rules=[
*markdown_whitespace_rules,
*prose_style_rules,
{'pattern': r'\[(?P<url>[^\]]+)\]\((?P=url)\)', {'pattern': r'\[(?P<url>[^\]]+)\]\((?P=url)\)',
'description': 'Linkified markdown URLs should use cleaner <http://example.com> syntax.'} 'description': 'Linkified markdown URLs should use cleaner <http://example.com> syntax.'}
], ],

View file

@ -98,6 +98,7 @@ force_include = [
"zulip_bots/zulip_bots/bots/susi/test_susi.py", "zulip_bots/zulip_bots/bots/susi/test_susi.py",
"zulip_bots/zulip_bots/bots/front/front.py", "zulip_bots/zulip_bots/bots/front/front.py",
"zulip_bots/zulip_bots/bots/front/test_front.py", "zulip_bots/zulip_bots/bots/front/test_front.py",
"tools/custom_check.py",
"tools/deploy" "tools/deploy"
] ]