Commit d6430f71 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

checkpatch: don't check .pl files, improve absolute path commit log test

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.

Link: http://lkml.kernel.org/r/85b101d50acafe6c0261d9f7df283c827da52c4a.1477340110.git.joe@perches.comSigned-off-by: default avatarJoe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 224236d9
...@@ -2601,20 +2601,6 @@ sub process { ...@@ -2601,20 +2601,6 @@ sub process {
$herecurr) if (!$emitted_corrupt++); $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 # UTF-8 regex found at http://www.w3.org/International/questions/qa-forms-utf-8.en.php
if (($realfile =~ /^$/ || $line =~ /^\+/) && if (($realfile =~ /^$/ || $line =~ /^\+/) &&
$rawline !~ m/^$UTF8*$/) { $rawline !~ m/^$UTF8*$/) {
...@@ -2652,6 +2638,20 @@ sub process { ...@@ -2652,6 +2638,20 @@ sub process {
"8-bit UTF-8 used in possible commit log\n" . $herecurr); "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 # Check for various typo / spelling mistakes
if (defined($misspellings) && if (defined($misspellings) &&
($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) { ($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) {
...@@ -2805,7 +2805,7 @@ sub process { ...@@ -2805,7 +2805,7 @@ sub process {
} }
# check we are in a valid source file if not then ignore this hunk # 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) # line length limit (with some exclusions)
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment