diff options
Diffstat (limited to 'gitlint/contrib')
-rw-r--r-- | gitlint/contrib/__init__.py | 0 | ||||
-rw-r--r-- | gitlint/contrib/rules/__init__.py | 0 | ||||
-rw-r--r-- | gitlint/contrib/rules/conventional_commit.py | 37 | ||||
-rw-r--r-- | gitlint/contrib/rules/signedoff_by.py | 18 |
4 files changed, 0 insertions, 55 deletions
diff --git a/gitlint/contrib/__init__.py b/gitlint/contrib/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/gitlint/contrib/__init__.py +++ /dev/null diff --git a/gitlint/contrib/rules/__init__.py b/gitlint/contrib/rules/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/gitlint/contrib/rules/__init__.py +++ /dev/null diff --git a/gitlint/contrib/rules/conventional_commit.py b/gitlint/contrib/rules/conventional_commit.py deleted file mode 100644 index 9c9d5cb..0000000 --- a/gitlint/contrib/rules/conventional_commit.py +++ /dev/null @@ -1,37 +0,0 @@ -import re - -from gitlint.options import ListOption -from gitlint.rules import CommitMessageTitle, LineRule, RuleViolation - -RULE_REGEX = re.compile(r"([^(]+?)(\([^)]+?\))?!?: .+") - - -class ConventionalCommit(LineRule): - """ This rule enforces the spec at https://www.conventionalcommits.org/. """ - - name = "contrib-title-conventional-commits" - id = "CT1" - target = CommitMessageTitle - - options_spec = [ - ListOption( - "types", - ["fix", "feat", "chore", "docs", "style", "refactor", "perf", "test", "revert", "ci", "build"], - "Comma separated list of allowed commit types.", - ) - ] - - def validate(self, line, _commit): - violations = [] - match = RULE_REGEX.match(line) - - if not match: - msg = "Title does not follow ConventionalCommits.org format 'type(optional-scope): description'" - violations.append(RuleViolation(self.id, msg, line)) - else: - line_commit_type = match.group(1) - if line_commit_type not in self.options["types"].value: - opt_str = ', '.join(self.options['types'].value) - violations.append(RuleViolation(self.id, f"Title does not start with one of {opt_str}", line)) - - return violations diff --git a/gitlint/contrib/rules/signedoff_by.py b/gitlint/contrib/rules/signedoff_by.py deleted file mode 100644 index 139a1b1..0000000 --- a/gitlint/contrib/rules/signedoff_by.py +++ /dev/null @@ -1,18 +0,0 @@ - -from gitlint.rules import CommitRule, RuleViolation - - -class SignedOffBy(CommitRule): - """ This rule will enforce that each commit body contains a "Signed-off-by" line. - We keep things simple here and just check whether the commit body contains a line that starts with "Signed-off-by". - """ - - name = "contrib-body-requires-signed-off-by" - id = "CC1" - - def validate(self, commit): - for line in commit.message.body: - if line.lower().startswith("signed-off-by"): - return [] - - return [RuleViolation(self.id, "Body does not contain a 'Signed-off-by' line", line_nr=1)] |