diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-11-19 14:52:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-11-19 14:53:01 +0000 |
commit | f3b6c222fb11c96e2f8bbaa0622f46c8ec486874 (patch) | |
tree | 0f38497775e27d3e16b20573b36dd22aa5b24f3e /examples/my_line_rules.py | |
parent | Releasing debian version 0.17.0-1. (diff) | |
download | gitlint-f3b6c222fb11c96e2f8bbaa0622f46c8ec486874.tar.xz gitlint-f3b6c222fb11c96e2f8bbaa0622f46c8ec486874.zip |
Merging upstream version 0.18.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'examples/my_line_rules.py')
-rw-r--r-- | examples/my_line_rules.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/examples/my_line_rules.py b/examples/my_line_rules.py index 3a1ef36..58b0108 100644 --- a/examples/my_line_rules.py +++ b/examples/my_line_rules.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from gitlint.rules import LineRule, RuleViolation, CommitMessageTitle from gitlint.options import ListOption @@ -21,8 +19,8 @@ that fits your needs. class SpecialChars(LineRule): - """ This rule will enforce that the commit message title does not contain any of the following characters: - $^%@!*() """ + """This rule will enforce that the commit message title does not contain any of the following characters: + $^%@!*()""" # A rule MUST have a human friendly name name = "title-no-special-chars" @@ -35,15 +33,20 @@ class SpecialChars(LineRule): target = CommitMessageTitle # A rule MAY have an option_spec if its behavior should be configurable. - options_spec = [ListOption('special-chars', ['$', '^', '%', '@', '!', '*', '(', ')'], - "Comma separated list of characters that should not occur in the title")] + options_spec = [ + ListOption( + "special-chars", + ["$", "^", "%", "@", "!", "*", "(", ")"], + "Comma separated list of characters that should not occur in the title", + ) + ] def validate(self, line, _commit): self.log.debug("SpecialChars: This will be visible when running `gitlint --debug`") violations = [] # options can be accessed by looking them up by their name in self.options - for char in self.options['special-chars'].value: + for char in self.options["special-chars"].value: if char in line: msg = f"Title contains the special character '{char}'" violation = RuleViolation(self.id, msg, line) |