From b8d423e7d13686d6627571d6c4adf12661d82147 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 13 Oct 2021 07:34:54 +0200 Subject: Adding upstream version 0.16.0. Signed-off-by: Daniel Baumann --- gitlint/config.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'gitlint/config.py') diff --git a/gitlint/config.py b/gitlint/config.py index 1eeb35d..6d2ead2 100644 --- a/gitlint/config.py +++ b/gitlint/config.py @@ -41,6 +41,7 @@ class LintConfig: default_rule_classes = (rules.IgnoreByTitle, rules.IgnoreByBody, rules.IgnoreBodyLines, + rules.IgnoreByAuthorName, rules.TitleMaxLength, rules.TitleTrailingWhitespace, rules.TitleLeadingWhitespace, @@ -76,6 +77,8 @@ class LintConfig: ignore_stdin_description = "Ignore any stdin data. Useful for running in CI server." self._ignore_stdin = options.BoolOption('ignore-stdin', False, ignore_stdin_description) self._staged = options.BoolOption('staged', False, "Read staged commit meta-info from the local repository.") + self._fail_without_commits = options.BoolOption('fail-without-commits', False, + "Hard fail when the target commit range is empty") @property def target(self): @@ -170,6 +173,15 @@ class LintConfig: def staged(self, value): return self._staged.set(value) + @property + def fail_without_commits(self): + return self._fail_without_commits.value + + @fail_without_commits.setter + @handle_option_error + def fail_without_commits(self, value): + return self._fail_without_commits.set(value) + @property def extra_path(self): return self._extra_path.value if self._extra_path else None @@ -275,6 +287,7 @@ class LintConfig: self.ignore_revert_commits == other.ignore_revert_commits and \ self.ignore_stdin == other.ignore_stdin and \ self.staged == other.staged and \ + self.fail_without_commits == other.fail_without_commits and \ self.debug == other.debug and \ self.ignore == other.ignore and \ self._config_path == other._config_path # noqa @@ -292,6 +305,7 @@ class LintConfig: f"ignore-revert-commits: {self.ignore_revert_commits}\n" f"ignore-stdin: {self.ignore_stdin}\n" f"staged: {self.staged}\n" + f"fail-without-commits: {self.fail_without_commits}\n" f"verbosity: {self.verbosity}\n" f"debug: {self.debug}\n" f"target: {self.target}\n" -- cgit v1.2.3