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 /gitlint-core/gitlint/contrib/rules/disallow_cleanup_commits.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 'gitlint-core/gitlint/contrib/rules/disallow_cleanup_commits.py')
-rw-r--r-- | gitlint-core/gitlint/contrib/rules/disallow_cleanup_commits.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gitlint-core/gitlint/contrib/rules/disallow_cleanup_commits.py b/gitlint-core/gitlint/contrib/rules/disallow_cleanup_commits.py new file mode 100644 index 0000000..7f62dee --- /dev/null +++ b/gitlint-core/gitlint/contrib/rules/disallow_cleanup_commits.py @@ -0,0 +1,22 @@ +from gitlint.rules import CommitRule, RuleViolation + + +class DisallowCleanupCommits(CommitRule): + """This rule checks the commits for "fixup!"/"squash!"/"amend!" commits + and rejects them. + """ + + name = "contrib-disallow-cleanup-commits" + id = "CC2" + + def validate(self, commit): + if commit.is_fixup_commit: + return [RuleViolation(self.id, "Fixup commits are not allowed", line_nr=1)] + + if commit.is_squash_commit: + return [RuleViolation(self.id, "Squash commits are not allowed", line_nr=1)] + + if commit.is_fixup_amend_commit: + return [RuleViolation(self.id, "Amend commits are not allowed", line_nr=1)] + + return [] |