diff --git a/requirements/dev.in b/requirements/dev.in index db43c35ffe..18de6fe5b4 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -57,7 +57,7 @@ python-digitalocean pip-tools<6.3.0 # https://github.com/jazzband/pip-tools/pull/1455 breaks our hack for installing specific commits from Git # zulip's linting framework - zulint -https://github.com/zulip/zulint/archive/80a613cca5ec35bc5add7f3c70916ce269a9d27c.zip#egg=zulint==0.0.1 +https://github.com/zulip/zulint/archive/34adbc13d54ebeb4291c8f91483f946fce18a160.zip#egg=zulint==0.0.1 -r mypy.in diff --git a/requirements/dev.txt b/requirements/dev.txt index dd54f789bb..8b9e95deef 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -2398,8 +2398,8 @@ zope.interface==5.4.0 \ # via # scrapy # twisted -https://github.com/zulip/zulint/archive/80a613cca5ec35bc5add7f3c70916ce269a9d27c.zip#egg=zulint==0.0.1 \ - --hash=sha256:e1e03c4599b0848f7e021a6f211d6ee06bf63602cbf25c7bb271ec51c911accf +https://github.com/zulip/zulint/archive/34adbc13d54ebeb4291c8f91483f946fce18a160.zip#egg=zulint==0.0.1 \ + --hash=sha256:18dd1fd2d8f5b3feb8468151ccae4c0e8345c77142093988dd96739ac9becac2 # via -r requirements/dev.in https://github.com/zulip/python-zulip-api/archive/0.8.2.zip#egg=zulip==0.8.2+git&subdirectory=zulip \ --hash=sha256:c85a2c76b265ef66478715bb2a38723c4942f84b2f876c3e0ba916962e3d0735 diff --git a/templates/zerver/help/bots-and-integrations.md b/templates/zerver/help/bots-and-integrations.md index 5bf3b62b6e..bfaba37eaf 100644 --- a/templates/zerver/help/bots-and-integrations.md +++ b/templates/zerver/help/bots-and-integrations.md @@ -67,7 +67,7 @@ A few more details: Slack-compatible format. This is the preferred bot type for interactive bots built on top of Zulip - botserver. + Botserver. ## Adding bots diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.py index cf076d8110..8d6e492696 100644 --- a/tools/linter_lib/custom_check.py +++ b/tools/linter_lib/custom_check.py @@ -37,7 +37,7 @@ FILES_WITH_LEGACY_SUBJECT = { shebang_rules: List["Rule"] = [ { - "pattern": "^#!", + "pattern": r"\A#!", "description": "zerver library code shouldn't have a shebang line.", "include_only": {"zerver/"}, }, @@ -45,32 +45,35 @@ shebang_rules: List["Rule"] = [ # that NixOS provides at a fixed path (outside a # buildFHSUserEnv sandbox). { - "pattern": "^#!(?! *(?:/usr/bin/env|/bin/sh)(?: |$))", + "pattern": r"\A#!(?! *(?:/usr/bin/env|/bin/sh)(?: |$))", "description": "Use `#!/usr/bin/env foo` instead of `#!/path/foo`" " for interpreters other than sh.", }, { - "pattern": "^#!/usr/bin/env python$", + "pattern": r"\A#!/usr/bin/env python$", "description": "Use `#!/usr/bin/env python3` instead of `#!/usr/bin/env python`.", }, ] -trailing_whitespace_rule: "Rule" = { - "pattern": r"\s+$", - "strip": "\n", - "exclude": {"tools/ci/success-http-headers.template.txt"}, - "description": "Fix trailing whitespace", -} +base_whitespace_rules: List["Rule"] = [ + { + "pattern": r"[\t ]+$", + "exclude": {"tools/ci/success-http-headers.template.txt"}, + "description": "Fix trailing whitespace", + }, + { + "pattern": r"[^\n]\Z", + "description": "Missing newline at end of file", + }, +] whitespace_rules: List["Rule"] = [ - # This linter should be first since bash_rules depends on it. - trailing_whitespace_rule, + *base_whitespace_rules, { "pattern": "http://zulip.readthedocs.io", "description": "Use HTTPS when linking to ReadTheDocs", }, { "pattern": "\t", - "strip": "\n", "description": "Fix tab-based whitespace", }, ] @@ -84,18 +87,16 @@ comma_whitespace_rule: List["Rule"] = [ }, ] markdown_whitespace_rules: List["Rule"] = [ - *(rule for rule in whitespace_rules if rule["pattern"] != r"\s+$"), + *(rule for rule in whitespace_rules if rule["pattern"] != r"[\t ]+$"), # Two spaces trailing a line with other content is okay--it's a Markdown line break. # This rule finds one space trailing a non-space, three or more trailing spaces, and # spaces on an empty line. { - "pattern": r"((?]([gG]ithub)[^\.\-\_"\<]""", # exclude usage in hrefs/divs + "pattern": r"""[^\n\/\-\."'\_\=\>]([gG]ithub)[^\n\.\-\_"\<]""", # exclude usage in hrefs/divs "description": "github should be spelled GitHub", }, { @@ -820,10 +820,9 @@ json_rules = RuleList( # version of the tab-based whitespace rule (we can't just use # exclude in whitespace_rules, since we only want to ignore # JSON files with tab-based whitespace, not webhook code). - trailing_whitespace_rule, + *base_whitespace_rules, { "pattern": "\t", - "strip": "\n", "exclude": {"zerver/webhooks/"}, "description": "Fix tab-based whitespace", }, @@ -835,27 +834,6 @@ json_rules = RuleList( ], ) -markdown_docs_length_exclude = { - # Has some example Vagrant output that's very long - "docs/development/setup-vagrant.md", - # Have wide output in code blocks - "docs/subsystems/logging.md", - "docs/subsystems/schema-migrations.md", - # Have curl commands with JSON that would be messy to wrap - "zerver/webhooks/helloworld/doc.md", - "zerver/webhooks/trello/doc.md", - # Has a very long configuration line - "templates/zerver/integrations/perforce.md", - # Has some example code that could perhaps be wrapped - "templates/zerver/api/incoming-webhooks-walkthrough.md", - "templates/zerver/api/get-messages.md", - # This macro has a long indented URL - "templates/zerver/help/include/git-webhook-url-with-branches-indented.md", - # These two are the same file and have some too-long lines for GitHub badges - "README.md", - "docs/overview/readme.md", -} - markdown_rules = RuleList( langs=["md"], rules=[ @@ -899,8 +877,6 @@ markdown_rules = RuleList( "description": "Don't link directly to line numbers", }, ], - max_length=120, - length_exclude=markdown_docs_length_exclude, exclude_files_in="templates/zerver/help/", ) @@ -926,14 +902,14 @@ help_markdown_rules = RuleList( "exclude_pattern": "(-realm-|[kK]eycloak)", }, ], - length_exclude=markdown_docs_length_exclude, ) puppet_rules = RuleList( langs=["pp"], rules=[ + *whitespace_rules, { - "pattern": r"(include\s+|\$)zulip::(profile|base)\b", + "pattern": r"(include[\t ]+|\$)zulip::(profile|base)\b", "exclude": { "puppet/zulip/manifests/profile/", "puppet/zulip_ops/manifests/", @@ -942,7 +918,7 @@ puppet_rules = RuleList( "description": "Abstraction layering violation; only profiles should reference profiles or zulip::base", }, { - "pattern": r"(include\s+|\$)zulip_ops::(profile|base)\b", + "pattern": r"(include[\t ]+|\$)zulip_ops::(profile|base)\b", "exclude": { "puppet/zulip/manifests/", "puppet/zulip_ops/manifests/profile/", diff --git a/version.py b/version.py index d554b618be..228ee76dc0 100644 --- a/version.py +++ b/version.py @@ -48,4 +48,4 @@ API_FEATURE_LEVEL = 132 # historical commits sharing the same major version, in which case a # minor version bump suffices. -PROVISION_VERSION = "188.1" +PROVISION_VERSION = "189.0"