mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* checkpatch warns about Fixes: lines
@ 2015-07-31 12:24 Paul Bolle
  2015-07-31 22:54 ` [PATCH] checkpatch: Avoid some commit message long line warnings Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Bolle @ 2015-07-31 12:24 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches; +Cc: linux-kernel

Andy, Joe,

Checkpatch (as shipped in today's linux-next) warns about "Fixes:"
lines:

WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#10: 
Fixes: 75722d3992f5 ("[PATCH] ppc64: Thermal control for SMU based machines")

ERROR: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit 75722d3992f5 ("[PATCH] ppc64: Thermal control for SMU based machines")'
#10: 
Fixes: 75722d3992f5 ("[PATCH] ppc64: Thermal control for SMU based machines")

total: 1 errors, 1 warnings, 8 lines checked

Your patch has style problems, please review.

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.

Both warnings seem false positives. "Fixes:" lines should be one line,
shouldn't they, and I think I did use the correct commit description
style here.

Thanks,


Paul Bolle

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] checkpatch: Avoid some commit message long line warnings
  2015-07-31 12:24 checkpatch warns about Fixes: lines Paul Bolle
@ 2015-07-31 22:54 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2015-07-31 22:54 UTC (permalink / raw)
  To: Paul Bolle, Andrew Morton; +Cc: Andy Whitcroft, linux-kernel

Fixes: and Link: lines may exceed 75 chars in the commit log.

So too can stack dump and dmesg lines and lines that seem
like filenames.

And Fixes: lines don't need to have a "commit" prefix before the
commit id.

Add exceptions for these types of lines.

Noticed-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 50693f5..4b71ab0 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1953,9 +1953,9 @@ sub process {
        our $clean = 1;
        my $signoff = 0;
        my $is_patch = 0;
-
        my $in_header_lines = $file ? 0 : 1;
        my $in_commit_log = 0;          #Scanning lines before patch
+       my $commit_log_possible_stack_dump = 0;
        my $commit_log_long_line = 0;
        my $commit_log_has_diff = 0;
        my $reported_maintainer_file = 0;
@@ -2314,16 +2314,40 @@ sub process {
 
 # Check for line lengths > 75 in commit log, warn once
                if ($in_commit_log && !$commit_log_long_line &&
-                   length($line) > 75) {
+                   length($line) > 75 &&
+                   !($line =~ /^\s*[a-zA-Z0-9_\/\.]+\s+\|\s+\d+/ ||
+                                       # file delta changes
+                     $line =~ /^\s*(?:[\w\.\-]+\/)++[\w\.\-]+:/ ||
+                                       # filename then :
+                     $line =~ /^\s*(?:Fixes:|Link:)/i ||
+                                       # A Fixes: or Link: line
+                     $commit_log_possible_stack_dump)) {
                        WARN("COMMIT_LOG_LONG_LINE",
                             "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);
                        $commit_log_long_line = 1;
                }
 
+# Check if the commit log is in a possible stack dump
+               if ($in_commit_log && !$commit_log_possible_stack_dump &&
+                   ($line =~ /^\s*(?:WARNING:|BUG:)/ ||
+                    $line =~ /^\s*\[\s*\d+\.\d{6,6}\s*\]/ ||
+                               # timestamp
+                    $line =~ /^\s*\[\<[0-9a-fA-F]{8,}\>\]/)) {
+                               # stack dump address
+                       $commit_log_possible_stack_dump = 1;
+               }
+
+# Reset possible stack dump if a blank line is found
+               if ($in_commit_log && $commit_log_possible_stack_dump &&
+                   $line =~ /^\s*$/) {
+                       $commit_log_possible_stack_dump = 0;
+               }
+
 # Check for git id commit length and improperly formed commit descriptions
                if ($in_commit_log &&
                    ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
-                    $line =~ /\b[0-9a-f]{12,40}\b/i)) {
+                    ($line =~ /\b[0-9a-f]{12,40}\b/i &&
+                     $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) {
                        my $init_char = "c";
                        my $orig_commit = "";
                        my $short = 1;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-31 22:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-31 12:24 checkpatch warns about Fixes: lines Paul Bolle
2015-07-31 22:54 ` [PATCH] checkpatch: Avoid some commit message long line warnings Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome