Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
lint: Rely on core gitlint skipping of revert commits.
Alex Vandiver12ade4c49d6a
diff --git a/.gitlint b/.gitlintindex 0afb421327a..9f31197ee29 100644--- a/.gitlint+++ b/.gitlint@@ -3,7 +3,7 @@ ignore=title-trailing-punctuation, body-min-length, body-is-missing, title-imperextra-path=tools/lib/gitlint-rules.py-[title-match-regex-allow-exception]+[title-match-regex]regex=^(.+:\ )?[A-Z].+\.$[title-max-length]diff --git a/requirements/dev.in b/requirements/dev.inindex cfc2c19b084..a500064aa80 100644--- a/requirements/dev.in+++ b/requirements/dev.in@@ -45,7 +45,7 @@ pyinotifytblib# Needed to lint Git commit messages-gitlint+gitlint>=0.13.0# Needed for visualising cprofile reportssnakevizdiff --git a/tools/lib/gitlint-rules.py b/tools/lib/gitlint-rules.pyindex 6b516ecc308..1ffc7c27db7 100644--- a/tools/lib/gitlint-rules.py+++ b/tools/lib/gitlint-rules.py@@ -1,8 +1,6 @@-import refrom typing import Listfrom gitlint.git import GitCommit-from gitlint.options import StrOptionfrom gitlint.rules import CommitMessageTitle, LineRule, RuleViolation# Word list from https://github.com/m1foley/fit-commit@@ -307,31 +305,10 @@ class ImperativeMood(LineRule):violation = RuleViolation(self.id,self.error_msg.format(- word=first_word,- imperative=imperative,- title=commit.message.title,+ word=first_word, imperative=imperative, title=commit.message.title,),)violations.append(violation)return violations---class TitleMatchRegexAllowException(LineRule):- """Allows revert commits contrary to the built-in title-match-regex rule"""-- name = "title-match-regex-allow-exception"- id = "Z2"- target = CommitMessageTitle- options_spec = [StrOption("regex", ".*", "Regex the title should match")]-- def validate(self, title: str, commit: GitCommit) -> List[RuleViolation]:-- regex = self.options["regex"].value- pattern = re.compile(regex, re.UNICODE)- if not pattern.search(title) and not title.startswith('Revert "'):- violation_msg = f"Title does not match regex ({regex})"- return [RuleViolation(self.id, violation_msg, title)]-- return []