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
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 { · 31 unmodified lines
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 { · 147 unmodified lines
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 #