]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
badwords: check FAQ with allowlisted 'will', fix a typo
authorViktor Szakats <commit@vsz.me>
Thu, 4 Dec 2025 16:44:46 +0000 (17:44 +0100)
committerViktor Szakats <commit@vsz.me>
Thu, 4 Dec 2025 18:30:08 +0000 (19:30 +0100)
Also:
- badwords.pl: add support for filename:word exceptions.
- badwords.pl: handle `-w` file open errors.

Ref: https://github.com/curl/curl/pull/19817#issuecomment-3612386568
Closes #19837

.github/scripts/badwords.ok [new file with mode: 0644]
.github/scripts/badwords.pl
.github/workflows/checkdocs.yml
docs/FAQ

diff --git a/.github/scripts/badwords.ok b/.github/scripts/badwords.ok
new file mode 100644 (file)
index 0000000..d5401a8
--- /dev/null
@@ -0,0 +1,7 @@
+# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
+#
+# SPDX-License-Identifier: curl
+#
+# whitelisted uses of bad words
+# file:[line]:rule
+docs/FAQ::\bwill\b
index 014468c6f99c049ac4c461cd4d688b17a619b879..1fde5ec4730ff221cf64c13df21e38ddf4eaa467 100755 (executable)
@@ -30,13 +30,13 @@ my %wl;
 if($ARGV[0] eq "-w") {
     shift @ARGV;
     my $file = shift @ARGV;
-    open(W, "<$file");
+    open(W, "<$file") or die "Cannot open '$file': $!";
     while(<W>) {
         if(/^#/) {
             # allow #-comments
             next;
         }
-        if(/^([^:]*):(\d+):(.*)/) {
+        if(/^([^:]*):(\d*):(.*)/) {
             $wl{"$1:$2:$3"}=1;
             #print STDERR "whitelisted $1:$2:$3\n";
         }
@@ -93,7 +93,13 @@ sub file {
 
                 my $ch = "$f:$l:$w";
                 if($wl{$ch}) {
-                    # whitelisted
+                    # whitelisted filename + line + word
+                    print STDERR "$ch found but whitelisted\n";
+                    next;
+                }
+                $ch = $f . "::" . $w;
+                if($wl{$ch}) {
+                    # whitelisted filename + word
                     print STDERR "$ch found but whitelisted\n";
                     next;
                 }
index 6f67b44fca895897dda07dd1e85f92b0be7a16eb..60d42301941e5661fb68b9ea4657ac64e869971d 100644 (file)
@@ -140,7 +140,7 @@ jobs:
           persist-credentials: false
 
       - name: 'badwords'
-        run: .github/scripts/badwords.pl '**.md' docs/TODO docs/KNOWN_BUGS packages/OS400/README.OS400 < .github/scripts/badwords.txt
+        run: .github/scripts/badwords.pl -w .github/scripts/badwords.ok '**.md' docs/FAQ docs/KNOWN_BUGS docs/TODO packages/OS400/README.OS400 < .github/scripts/badwords.txt
 
       - name: 'verify synopsis'
         run: .github/scripts/verify-synopsis.pl docs/libcurl/curl*.md
index 6ba339c7d55cdb71015d50f856b831e7319f41b6..15cfee848cc64b919e82a3b6e52523ba61b43e8b 100644 (file)
--- a/docs/FAQ
+++ b/docs/FAQ
@@ -666,7 +666,7 @@ FAQ
   does not require this, you do not need a client certificate.
 
   A client certificate is always used together with a private key, and the
-  private key has a pass phrase that protects it.
+  private key has a passphrase that protects it.
 
   SERVER CERTIFICATE