Skip to content

Commit d6430f7

Browse files
JoePerchestorvalds
authored andcommitted
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.com Signed-off-by: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 224236d commit d6430f7

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

scripts/checkpatch.pl

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2601,20 +2601,6 @@ sub process {
26012601
$herecurr) if (!$emitted_corrupt++);
26022602
}
26032603

2604-
# Check for absolute kernel paths.
2605-
if ($tree) {
2606-
while ($line =~ m{(?:^|\s)(/\S*)}g) {
2607-
my $file = $1;
2608-
2609-
if ($file =~ m{^(.*?)(?::\d+)+:?$} &&
2610-
check_absolute_file($1, $herecurr)) {
2611-
#
2612-
} else {
2613-
check_absolute_file($file, $herecurr);
2614-
}
2615-
}
2616-
}
2617-
26182604
# UTF-8 regex found at http://www.w3.org/International/questions/qa-forms-utf-8.en.php
26192605
if (($realfile =~ /^$/ || $line =~ /^\+/) &&
26202606
$rawline !~ m/^$UTF8*$/) {
@@ -2652,6 +2638,20 @@ sub process {
26522638
"8-bit UTF-8 used in possible commit log\n" . $herecurr);
26532639
}
26542640

2641+
# Check for absolute kernel paths in commit message
2642+
if ($tree && $in_commit_log) {
2643+
while ($line =~ m{(?:^|\s)(/\S*)}g) {
2644+
my $file = $1;
2645+
2646+
if ($file =~ m{^(.*?)(?::\d+)+:?$} &&
2647+
check_absolute_file($1, $herecurr)) {
2648+
#
2649+
} else {
2650+
check_absolute_file($file, $herecurr);
2651+
}
2652+
}
2653+
}
2654+
26552655
# Check for various typo / spelling mistakes
26562656
if (defined($misspellings) &&
26572657
($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) {
@@ -2805,7 +2805,7 @@ sub process {
28052805
}
28062806

28072807
# check we are in a valid source file if not then ignore this hunk
2808-
next if ($realfile !~ /\.(h|c|s|S|pl|sh|dtsi|dts)$/);
2808+
next if ($realfile !~ /\.(h|c|s|S|sh|dtsi|dts)$/);
28092809

28102810
# line length limit (with some exclusions)
28112811
#

0 commit comments

Comments
 (0)