Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/firecracker
Path: blob/main/tests/framework/gitlint_rules.py
1956 views
1
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
# SPDX-License-Identifier: Apache-2.0
3
"""The user defined rules for gitlint."""
4
5
from gitlint.rules import CommitRule, RuleViolation
6
7
8
class SignedOffBy(CommitRule):
9
"""Make sure that each commit contains a "Signed-off-by" line."""
10
11
# The name of the rule.
12
name = "body-requires-signed-off-by"
13
14
# The unique id of the rule.
15
id = "UC2"
16
17
def validate(self, commit):
18
"""Validate user defined gitlint rules."""
19
for line in commit.message.body:
20
if line.startswith("Signed-off-by"):
21
return []
22
23
msg = "Body does not contain a 'Signed-off-by' line"
24
return [RuleViolation(self.id, msg, line_nr=1)]
25
26