summaryrefslogtreecommitdiffstats
path: root/gitlint/config.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitlint/config.py')
-rw-r--r--gitlint/config.py14
1 files changed, 14 insertions, 0 deletions
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):
@@ -171,6 +174,15 @@ class LintConfig:
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"