Patrick Williams | 9ce4de3 | 2025-02-26 17:48:30 -0500 | [diff] [blame^] | 1 | from gitlint.rules import CommitRule, RuleViolation |
2 | |||||
3 | |||||
4 | class DuplicateChangeIdEntries(CommitRule): | ||||
5 | name = "duplicate-change-id-entries" | ||||
6 | id = "UC2" | ||||
7 | |||||
8 | def validate(self, commit): | ||||
9 | change_ids = [ | ||||
10 | x for x in commit.message.body if x.startswith("Change-Id:") | ||||
11 | ] | ||||
12 | if len(change_ids) > 1: | ||||
13 | return [ | ||||
14 | RuleViolation( | ||||
15 | self.id, | ||||
16 | "Multiple Change-Ids found in commit message body", | ||||
17 | change_ids, | ||||
18 | ) | ||||
19 | ] | ||||
20 | |||||
21 | return None |