From 85812cd25d9e2f015bb71b26d51458b3718bf6c7 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 3 Nov 2020 07:07:48 +0100 Subject: Merging upstream version 0.14.0. Signed-off-by: Daniel Baumann --- examples/my_commit_rules.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'examples/my_commit_rules.py') diff --git a/examples/my_commit_rules.py b/examples/my_commit_rules.py index e12e02d..c64008f 100644 --- a/examples/my_commit_rules.py +++ b/examples/my_commit_rules.py @@ -1,9 +1,13 @@ +# -*- coding: utf-8 -*- + from gitlint.rules import CommitRule, RuleViolation from gitlint.options import IntOption, ListOption from gitlint import utils """ +Full details on user-defined rules: https://jorisroovers.com/gitlint/user_defined_rules + The classes below are examples of user-defined CommitRules. Commit rules are gitlint rules that act on the entire commit at once. Once the rules are discovered, gitlint will automatically take care of applying them to the entire commit. This happens exactly once per commit. @@ -28,6 +32,8 @@ class BodyMaxLineCount(CommitRule): options_spec = [IntOption('max-line-count', 3, "Maximum body line count")] def validate(self, commit): + self.log.debug("BodyMaxLineCount: This will be visible when running `gitlint --debug`") + line_count = len(commit.message.body) max_line_count = self.options['max-line-count'].value if line_count > max_line_count: @@ -47,6 +53,8 @@ class SignedOffBy(CommitRule): id = "UC2" def validate(self, commit): + self.log.debug("SignedOffBy: This will be visible when running `gitlint --debug`") + for line in commit.message.body: if line.startswith("Signed-Off-By"): return @@ -69,6 +77,8 @@ class BranchNamingConventions(CommitRule): options_spec = [ListOption('branch-prefixes', ["feature/", "hotfix/", "release/"], "Allowed branch prefixes")] def validate(self, commit): + self.log.debug("BranchNamingConventions: This line will be visible when running `gitlint --debug`") + violations = [] allowed_branch_prefixes = self.options['branch-prefixes'].value for branch in commit.branches: -- cgit v1.2.3