[PATCH] checkpatch: don't warn about long lines with footnote links

From: Ahmad Fatoum
Date: Mon Jan 13 2025 - 17:22:10 EST


checkpatch will warn[0] about lines like the first footnote below,
but breaking into multiple lines is not an option if the footnote
is just a URL.

While there's already an exception for Link: tags and some commit
messages add a footnote after it[1], the result is more noisy and harder
to follow when mixed with non-URL footnotes, so explicit support for
footnotes-prefixed URLs makes sense.

[0]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/checkpatch.pl#n3289
[1]: Commit 6612ac8c625c ("lib/list_sort: clarify comparison function
requirements in list_sort()")

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
scripts/checkpatch.pl | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 7b28ad3317427a6bf9e27b77065aa3915cb13053..febc05c381856361120c02b9b52694cc6fa95302 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -642,6 +642,8 @@ foreach my $entry (@link_tags) {
}
$link_tags_search = "(?:${link_tags_search})";

+our $link_footnote = "(?:\\[\\d\\]: https?://)";
+
our $tracing_logging_tags = qr{(?xi:
[=-]*> |
<[=-]* |
@@ -3272,8 +3274,8 @@ sub process {
# file delta changes
$line =~ /^\s*(?:[\w\.\-\+]*\/)++[\w\.\-\+]+:/ ||
# filename then :
- $line =~ /^\s*(?:Fixes:|$link_tags_search|$signature_tags)/i ||
- # A Fixes:, link or signature tag line
+ $line =~ /^\s*(?:Fixes:|$link_tags_search|$signature_tags|$link_footnote)/i ||
+ # A Fixes:, link, footnote or signature tag line
$commit_log_possible_stack_dump)) {
WARN("COMMIT_LOG_LONG_LINE",
"Prefer a maximum 75 chars per line (possible unwrapped commit description?)\n" . $herecurr);

---
base-commit: 37136bf5c3a6f6b686d74f41837a6406bec6b7bc
change-id: 20250113-footnote-links-acbd4d0e5439

Best regards,
--
Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>