From f826d926014f7a95adddce4630182cd2335a7f97 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Thu, 13 Nov 2025 13:24:19 +0100 Subject: [PATCH] misc: gitlint: allow well-known commit tags to exceed line limit To get that list, I've used ``` git log | grep --fixed-strings -- "-by:" | head -n 100000 | sort | less ``` on the Linux kernel's git repository. Signed-off-by: Philipp Schuster On-behalf-of: SAP philipp.schuster@sap.com --- scripts/gitlint/rules/BodyMaxLineLengthEx.py | 29 ++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/scripts/gitlint/rules/BodyMaxLineLengthEx.py b/scripts/gitlint/rules/BodyMaxLineLengthEx.py index 88314fc52..5541fb30e 100644 --- a/scripts/gitlint/rules/BodyMaxLineLengthEx.py +++ b/scripts/gitlint/rules/BodyMaxLineLengthEx.py @@ -4,6 +4,30 @@ from gitlint.rules import LineRule, RuleViolation, CommitMessageBody import re +IGNORE_PREFIXES = [ + # Please sort alphabetically + "Acked-by: ", + "Co-authored-by: ", + "Co-developed-by: ", + "Debugged-by: ", + "Diagnosed-by: ", + "Explained-by: ", + "Fixed-by: ", + "Fixes: ", + "Helped-by: ", + "Inspired-by: ", + "On-behalf-of: ", + "Originally-by: ", + "Reported-by: ", + "Reviewed-and-tested-by: ", + "Reviewed-by: ", + "Signed-off-by: ", + "Suggested-by: ", + "Tested-by: ", + "Triggered-by: ", +] + + class BodyMaxLineLengthEx(LineRule): """A rule to enforce a line limit of 72 characters, except for valid cases.""" @@ -44,6 +68,11 @@ class BodyMaxLineLengthEx(LineRule): if is_link: return + # Don't check lines with allowed prefixes + for prefix in IGNORE_PREFIXES: + if line.startswith(prefix): + return None + return [ RuleViolation(self.id, f"Line '{line}' exceeds limit of {self.max_len}") ]