blob: 2f71b6de444738708c74d7ca9eab415a651c4e62 [file] [log] [blame]
Patrick Williams9ce4de32025-02-26 17:48:30 -05001from gitlint.rules import CommitRule, RuleViolation
2
3
4class 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