checkpatch: fix check for the FSF address
[openocd.git] / tools / scripts / checkpatch.pl
index edbd464b2622514aed53bb462248a133215454df..9ef94ff43d1b1b3fb987ecde2a219d80e619c3d0 100755 (executable)
@@ -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);
        }
 }
@@ -597,6 +599,7 @@ our $typeTypedefs = qr{(?x:
 
 our $zero_initializer = qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b};
 
+if (!$OpenOCD) {
 our $logFunctions = qr{(?x:
        printk(?:_ratelimited|_once|_deferred_once|_deferred|)|
        (?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)|
@@ -606,6 +609,12 @@ our $logFunctions = qr{(?x:
        MODULE_[A-Z_]+|
        seq_vprintf|seq_printf|seq_puts
 )};
+} # !$OpenOCD
+# OpenOCD specific: Begin: list log functions
+our $logFunctions = qr{(?x:
+       LOG_(?:TARGET_|)(?:DEBUG_IO|DEBUG|INFO|WARNING|ERROR|USER|USER_N|OUTPUT)
+)};
+# OpenOCD specific: End
 
 our $allocFunctions = qr{(?x:
        (?:(?:devm_)?
@@ -1335,11 +1344,21 @@ NOTE: perl $^V is not modern enough to detect all possible issues.
 EOM
        }
        if ($exit) {
+               if (!$OpenOCD) {
                print << "EOM"
 
 NOTE: If any of the errors are false positives, please report
       them to the maintainer, see CHECKPATCH in MAINTAINERS.
 EOM
+               } # !$OpenOCD
+               # OpenOCD specific: Begin
+               print << "EOM"
+
+NOTE: If any of the errors are false positives, please report
+      them to the openocd-devel mailing list or prepare a patch
+      and send it to Gerrit for review.
+EOM
+               # OpenOCD specific: End
        }
 }
 
@@ -1348,11 +1367,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) {
@@ -1396,6 +1423,10 @@ sub parse_email {
                        $address = "";
                        $comment = "";
                }
+       # OpenOCD specific: Begin: handle jenkins as valid email
+       } elsif ($formatted_email eq "jenkins") {
+                       $address = "jenkins";
+       # OpenOCD specific: End
        }
 
        # Extract comments from names excluding quoted parts
@@ -3367,6 +3398,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;
@@ -3482,7 +3516,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

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)