diff options
Diffstat (limited to 'qa/samples')
-rw-r--r-- | qa/samples/config/contrib-enabled | 0 | ||||
-rw-r--r-- | qa/samples/config/gitlintconfig | 13 | ||||
-rw-r--r-- | qa/samples/config/ignore-release-commits | 7 | ||||
-rw-r--r-- | qa/samples/user_rules/extra/extra_rules.py | 29 | ||||
-rw-r--r-- | qa/samples/user_rules/incorrect_linerule/my_line_rule.py | 8 |
5 files changed, 57 insertions, 0 deletions
diff --git a/qa/samples/config/contrib-enabled b/qa/samples/config/contrib-enabled new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/qa/samples/config/contrib-enabled diff --git a/qa/samples/config/gitlintconfig b/qa/samples/config/gitlintconfig new file mode 100644 index 0000000..a5ecb84 --- /dev/null +++ b/qa/samples/config/gitlintconfig @@ -0,0 +1,13 @@ +[general] +ignore=title-trailing-punctuation,B2 +verbosity = 2 + +[title-max-length] +line-length=20 + +[B1] +# B1 = body-max-line-length +line-length=30 + +[title-must-not-contain-word] +words=WIP,thåt
\ No newline at end of file diff --git a/qa/samples/config/ignore-release-commits b/qa/samples/config/ignore-release-commits new file mode 100644 index 0000000..5807c96 --- /dev/null +++ b/qa/samples/config/ignore-release-commits @@ -0,0 +1,7 @@ +[ignore-by-title] +regex=^Release(.*) +ignore=T5,T3 + +[ignore-by-body] +regex=(.*)relëase(.*) +ignore=T3,B3
\ No newline at end of file diff --git a/qa/samples/user_rules/extra/extra_rules.py b/qa/samples/user_rules/extra/extra_rules.py new file mode 100644 index 0000000..8109299 --- /dev/null +++ b/qa/samples/user_rules/extra/extra_rules.py @@ -0,0 +1,29 @@ +from gitlint.rules import CommitRule, RuleViolation +from gitlint.utils import sstr + + +class GitContextRule(CommitRule): + """ Rule that tests whether we can correctly access certain gitcontext properties """ + name = "gitcontext" + id = "UC1" + + def validate(self, commit): + violations = [ + RuleViolation(self.id, "GitContext.current_branch: {0}".format(commit.context.current_branch), line_nr=1), + RuleViolation(self.id, "GitContext.commentchar: {0}".format(commit.context.commentchar), line_nr=1) + ] + + return violations + + +class GitCommitRule(CommitRule): + """ Rule that tests whether we can correctly access certain commit properties """ + name = "gitcommit" + id = "UC2" + + def validate(self, commit): + violations = [ + RuleViolation(self.id, "GitCommit.branches: {0}".format(sstr(commit.branches)), line_nr=1), + ] + + return violations diff --git a/qa/samples/user_rules/incorrect_linerule/my_line_rule.py b/qa/samples/user_rules/incorrect_linerule/my_line_rule.py new file mode 100644 index 0000000..33e511f --- /dev/null +++ b/qa/samples/user_rules/incorrect_linerule/my_line_rule.py @@ -0,0 +1,8 @@ +from gitlint.rules import LineRule + + +class MyUserLineRule(LineRule): + id = "UC2" + name = "my-line-rule" + + # missing validate method, missing target attribute |