summaryrefslogtreecommitdiffstats
path: root/gitlint/contrib/rules/signedoff_by.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2020-03-19 14:00:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2020-03-19 14:00:14 +0000
commitdf9615bac55ac6f1c3f516b66279ac0007175030 (patch)
tree84dd81d1c97835271cea7fbdd67c074742365e07 /gitlint/contrib/rules/signedoff_by.py
parentInitial commit. (diff)
downloadgitlint-df9615bac55ac6f1c3f516b66279ac0007175030.tar.xz
gitlint-df9615bac55ac6f1c3f516b66279ac0007175030.zip
Adding upstream version 0.13.1.upstream/0.13.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gitlint/contrib/rules/signedoff_by.py')
-rw-r--r--gitlint/contrib/rules/signedoff_by.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/gitlint/contrib/rules/signedoff_by.py b/gitlint/contrib/rules/signedoff_by.py
new file mode 100644
index 0000000..c2034e7
--- /dev/null
+++ b/gitlint/contrib/rules/signedoff_by.py
@@ -0,0 +1,18 @@
+
+from gitlint.rules import CommitRule, RuleViolation
+
+
+class SignedOffBy(CommitRule):
+ """ This rule will enforce that each commit body contains a "Signed-Off-By" line.
+ We keep things simple here and just check whether the commit body contains a line that starts with "Signed-Off-By".
+ """
+
+ name = "contrib-body-requires-signed-off-by"
+ id = "CC1"
+
+ def validate(self, commit):
+ for line in commit.message.body:
+ if line.startswith("Signed-Off-By"):
+ return []
+
+ return [RuleViolation(self.id, "Body does not contain a 'Signed-Off-By' line", line_nr=1)]