Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1507689

[PATCH] checkpatch: Don't check .pl files, improve absolute path commit log test

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject [PATCH] checkpatch: Don't check .pl files, improve absolute path commit log test
Date 2016-10-24 22:20 +0200
Message-ID <svTSW-43c-13@gated-at.bofh.it> (permalink)
References <svStP-31f-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


perl files (*.pl) are mostly inappropriate to check coding styles so
exempt them from long line checks and various .[ch] file type tests.

And as well, only scan absolute paths in the commit log, not in the patch.

Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a8368d1c4348..2fc154bd81c0 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2601,20 +2601,6 @@ sub process {
 				$herecurr) if (!$emitted_corrupt++);
 		}
 
-# Check for absolute kernel paths.
-		if ($tree) {
-			while ($line =~ m{(?:^|\s)(/\S*)}g) {
-				my $file = $1;
-
-				if ($file =~ m{^(.*?)(?::\d+)+:?$} &&
-				    check_absolute_file($1, $herecurr)) {
-					#
-				} else {
-					check_absolute_file($file, $herecurr);
-				}
-			}
-		}
-
 # UTF-8 regex found at http://www.w3.org/International/questions/qa-forms-utf-8.en.php
 		if (($realfile =~ /^$/ || $line =~ /^\+/) &&
 		    $rawline !~ m/^$UTF8*$/) {
@@ -2652,6 +2638,20 @@ sub process {
 			    "8-bit UTF-8 used in possible commit log\n" . $herecurr);
 		}
 
+# Check for absolute kernel paths in commit message
+		if ($tree && $in_commit_log) {
+			while ($line =~ m{(?:^|\s)(/\S*)}g) {
+				my $file = $1;
+
+				if ($file =~ m{^(.*?)(?::\d+)+:?$} &&
+				    check_absolute_file($1, $herecurr)) {
+					#
+				} else {
+					check_absolute_file($file, $herecurr);
+				}
+			}
+		}
+
 # Check for various typo / spelling mistakes
 		if (defined($misspellings) &&
 		    ($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) {
@@ -2805,7 +2805,7 @@ sub process {
 		}
 
 # check we are in a valid source file if not then ignore this hunk
-		next if ($realfile !~ /\.(h|c|s|S|pl|sh|dtsi|dts)$/);
+		next if ($realfile !~ /\.(h|c|s|S|sh|dtsi|dts)$/);
 
 # line length limit (with some exclusions)
 #
-- 
2.10.0.rc2.1.g053435c

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/1] checkpatch: remove false warning for commit reference Heinrich Schuchardt <xypron.glpk@gmx.de> - 2016-10-23 09:50 +0200
  Re: [PATCH 1/1] checkpatch: remove false warning for commit  reference Joe Perches <joe@perches.com> - 2016-10-23 22:40 +0200
    Re: [PATCH 1/1] checkpatch: remove false warning for commit reference Heinrich Schuchardt <xypron.glpk@gmx.de> - 2016-10-24 19:30 +0200
      Re: [PATCH 1/1] checkpatch: remove false warning for commit reference Andy Whitcroft <apw@canonical.com> - 2016-10-24 20:50 +0200
        [PATCH] checkpatch: Don't check .pl files, improve absolute path commit log test Joe Perches <joe@perches.com> - 2016-10-24 22:20 +0200
      Re: [PATCH 1/1] checkpatch: remove false warning for commit  reference Joe Perches <joe@perches.com> - 2016-10-24 20:50 +0200

csiph-web