X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=tools%2Fscripts%2Fcheckpatch.pl;h=12e7ab855d80083353423642e722e74fcb1588ff;hb=496308701342032d54bfe04c6e2653be252ccd94;hp=aa3e63743a39bff5d459906b3ff2773e42a933b9;hpb=ccdc51e2de9a5379e9aaa2ff15e0be3e73b265c1;p=fw%2Fopenocd diff --git a/tools/scripts/checkpatch.pl b/tools/scripts/checkpatch.pl index aa3e63743..12e7ab855 100755 --- a/tools/scripts/checkpatch.pl +++ b/tools/scripts/checkpatch.pl @@ -97,7 +97,7 @@ Version: $V Options: -q, --quiet quiet -v, --verbose verbose mode - --no-tree run without a kernel tree + --no-tree run without an OpenOCD tree --no-signoff do not check for 'Signed-off-by' line --patch treat FILE as patchfile (default) --emacs emacs compile window format @@ -124,7 +124,7 @@ Options: requires --strict for use with --file --min-conf-desc-length=n set the min description length, if shorter, warn --tab-size=n set the number of spaces for tab (default $tabsize) - --root=PATH PATH to the kernel tree root + --root=PATH PATH to the OpenOCD tree root --no-summary suppress the per-file summary --mailback only produce a report in case of warnings/errors --summary-file include the filename in summary @@ -461,14 +461,16 @@ if ($tree) { } else { if (top_of_kernel_tree('.')) { $root = '.'; - } elsif ($0 =~ m@(.*)/scripts/[^/]*$@ && + # OpenOCD specific: Begin: replace s"/scripts/"/tools/scripts/" + } elsif ($0 =~ m@(.*)/tools/scripts/[^/]*$@ && top_of_kernel_tree($1)) { $root = $1; } + # OpenOCD specific: End } if (!defined $root) { - print "Must be run from the top-level dir. of a kernel tree\n"; + print "Must be run from the top-level dir. of an OpenOCD tree\n"; exit(2); } } @@ -1130,10 +1132,12 @@ sub is_maintained_obsolete { sub is_SPDX_License_valid { my ($license) = @_; - return 1 if (!$tree || which("python3") eq "" || !(-x "$root/scripts/spdxcheck.py") || !(-e "$gitroot")); + # OpenOCD specific: Begin: replace s"scripts"tools/scripts" + return 1 if (!$tree || which("python3") eq "" || !(-x "$root/tools/scripts/spdxcheck.py") || !(-e "$gitroot")); my $root_path = abs_path($root); - my $status = `cd "$root_path"; echo "$license" | scripts/spdxcheck.py -`; + my $status = `cd "$root_path"; echo "$license" | tools/scripts/spdxcheck.py -`; + # OpenOCD specific: End return 0 if ($status ne ""); return 1; } @@ -1365,11 +1369,19 @@ exit($exit); sub top_of_kernel_tree { my ($root) = @_; + if (!$OpenOCD) { my @tree_check = ( "COPYING", "CREDITS", "Kbuild", "MAINTAINERS", "Makefile", "README", "Documentation", "arch", "include", "drivers", "fs", "init", "ipc", "kernel", "lib", "scripts", ); + } # !$OpenOCD + # OpenOCD specific: Begin + my @tree_check = ( + "AUTHORS", "BUGS", "COPYING", "HACKING", "Makefile.am", + "README", "contrib", "doc", "src", "tcl", "testing", "tools", + ); + # OpenOCD specific: End foreach my $check (@tree_check) { if (! -e $root . '/' . $check) { @@ -2999,6 +3011,13 @@ sub process { } } +# OpenOCD specific: Begin: Extend list of checkpatch tests to ignore + if ($in_commit_log && $line =~ /^\s*Checkpatch-ignore:\s*(.*)/) { + my @array = split(/[\s,]+/, $1); + hash_save_array_words(\%ignore_type, \@array); + } +# OpenOCD specific: End + # Check for patch separator if ($line =~ /^---$/) { $has_patch_separator = 1; @@ -3388,6 +3407,9 @@ sub process { # Check for various typo / spelling mistakes if (defined($misspellings) && + # OpenOCD specific: Begin: don't check spelling on spelling_file + index($spelling_file, $realfile) + length($realfile) != length($spelling_file) && + # OpenOCD specific: End ($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) { while ($rawline =~ /(?:^|[^\w\-'`])($misspellings)(?:[^\w\-'`]|$)/gi) { my $typo = $1; @@ -3503,7 +3525,7 @@ sub process { my $msg_level = \&ERROR; $msg_level = \&CHK if ($file); &{$msg_level}("FSF_MAILING_ADDRESS", - "Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so again. Linux already includes a copy of the GPL.\n" . $herevet) + "Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so again. OpenOCD already includes a copy of the GPL.\n" . $herevet) } # check for Kconfig help text having a real description @@ -3656,6 +3678,10 @@ sub process { $comment = '#'; } elsif ($realfile =~ /\.rst$/) { $comment = '..'; + # OpenOCD specific: Begin + } elsif ($realfile =~ /\.(am|cfg|tcl)$/) { + $comment = '#'; + # OpenOCD specific: End } # check SPDX comment style for .[chsS] files @@ -4219,7 +4245,9 @@ sub process { my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0); - if ($line =~ /^\+\t{6,}/) { + # OpenOCD specific: Begin: replace s/6/10/ + if ($line =~ /^\+\t{10,}/) { + # OpenOCD specific: End WARN("DEEP_INDENTATION", "Too many leading tabs - consider code refactoring\n" . $herecurr); }