History

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.

Joe Perches committed 9 years ago

Commit d6430f71 parent 224236d1 file · +15 −15Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+15−15
@@ -2601,20 +2601,6 @@ sub process { · 2600 unmodified lines
2601 $herecurr) if (!$emitted_corrupt++);2601 $herecurr) if (!$emitted_corrupt++);
2602 }2602 }
2603 2603
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
2618# UTF-8 regex found at http://www.w3.org/International/questions/qa-forms-utf-8.en.php2604# UTF-8 regex found at http://www.w3.org/International/questions/qa-forms-utf-8.en.php
2619 if (($realfile =~ /^$/ || $line =~ /^\+/) &&2605 if (($realfile =~ /^$/ || $line =~ /^\+/) &&
2620 $rawline !~ m/^$UTF8*$/) {2606 $rawline !~ m/^$UTF8*$/) {
@@ -2652,6 +2638,20 @@ sub process { · 31 unmodified lines
2652 "8-bit UTF-8 used in possible commit log\n" . $herecurr);2638 "8-bit UTF-8 used in possible commit log\n" . $herecurr);
2653 }2639 }
2654 2640
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
2655# Check for various typo / spelling mistakes2655# Check for various typo / spelling mistakes
2656 if (defined($misspellings) &&2656 if (defined($misspellings) &&
2657 ($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) {2657 ($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) {
@@ -2805,7 +2805,7 @@ sub process { · 147 unmodified lines
2805 }2805 }
2806 2806
2807# check we are in a valid source file if not then ignore this hunk2807# 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)$/);
2809 2809
2810# line length limit (with some exclusions)2810# line length limit (with some exclusions)
2811#2811#