]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
checkpatch: Add WARN on commit subject > 70
authorMichalis Pappas <michalis@unikraft.io>
Mon, 29 Jan 2024 11:21:42 +0000 (12:21 +0100)
committerUnikraft Bot <monkey@unikraft.io>
Tue, 6 Feb 2024 17:14:53 +0000 (17:14 +0000)
Replay commit 498f4a7ffc54 ("support/scripts: `checkpatch` `WARN`
on commit subject > 70 chars")

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1289

support/scripts/checkpatch.pl

index 0ffc7d4ac317d0c9f0e64d8be64da8ac71c7d2c2..1367082cb9cd2445029e9aa53604dc7ee7864610 100755 (executable)
@@ -3253,6 +3253,25 @@ sub process {
                             "Patch subject line does not follow Unikraft scheme: '[Selector]/[Component]: [Short message]'\n" . $herecurr);
                }
 
+# Check that the first line in the commit message has less than
+# 70 characters to comply with Github UI. This helps
+# avoid commit message subjects placed at the beginning
+# to overflow into the second line when viewing through
+# the Github UI.
+               if ($in_header_lines &&
+                   $line =~ /^Subject:.*$/i) {
+                       my $commit_subject_line0 = $1 if
+                               $lines[$linenr - 1] =~ /^Subject: \[.*\] (.*)$/;
+                       my $commit_subject_line1 = $lines[$linenr];
+                       my $commit_subject = $commit_subject_line0 .
+                                            $commit_subject_line1;
+                       if (length($commit_subject) > 70) {
+                               WARN("COMMIT_SUBJECT_LONG_LINE",
+                                    "Possible unwrapped commit subject (prefer a maximum 70 chars)\n" . $commit_subject);
+                               $commit_log_long_line = 1;
+                       }
+               }
+
 # Check for Gerrit Change-Ids not in any patch context
                if ($realfile eq '' && !$has_patch_separator && $line =~ /^\s*change-id:/i) {
                        if (ERROR("GERRIT_CHANGE_ID",