mirror of
https://github.com/curl/curl.git
synced 2026-07-27 02:57:24 +03:00
badwords: re-sync with curl-www, fix issues found
Also: - replace `manpage` with `man page`, add to `badwords.txt`. - badwords.pl: import `-w` feature from curl-www, syncing the two scripts fully. - badwords.txt: import missing items from curl-www, syncing the two files fully. - pyspelling.words: drop `cURL` allowed word. Closes #19468
This commit is contained in:
parent
ebc5fea64d
commit
4841e4290d
27 changed files with 109 additions and 78 deletions
28
.github/scripts/badwords.pl
vendored
28
.github/scripts/badwords.pl
vendored
|
|
@ -21,6 +21,24 @@ my @whitelist;
|
|||
my %alt;
|
||||
my %exactcase;
|
||||
|
||||
my %wl;
|
||||
if($ARGV[0] eq "-w") {
|
||||
shift @ARGV;
|
||||
my $file = shift @ARGV;
|
||||
open(W, "<$file");
|
||||
while(<W>) {
|
||||
if(/^#/) {
|
||||
# allow #-comments
|
||||
next;
|
||||
}
|
||||
if(/^([^:]*):(\d+):(.*)/) {
|
||||
$wl{"$1:$2:$3"}=1;
|
||||
#print STDERR "whitelisted $1:$2:$3\n";
|
||||
}
|
||||
}
|
||||
close(W);
|
||||
}
|
||||
|
||||
my @w;
|
||||
while(<STDIN>) {
|
||||
chomp;
|
||||
|
|
@ -30,7 +48,7 @@ while(<STDIN>) {
|
|||
if($_ =~ /^---(.*)/) {
|
||||
push @whitelist, $1;
|
||||
}
|
||||
elsif($_ =~ /^([^:=]*)([:=])(.*)/) {
|
||||
elsif($_ =~ /^(.*)([:=])(.*)/) {
|
||||
my ($bad, $sep, $better)=($1, $2, $3);
|
||||
push @w, $bad;
|
||||
$alt{$bad} = $better;
|
||||
|
|
@ -67,6 +85,14 @@ sub file {
|
|||
($in =~ /^(.*)$w/ && $case) ) {
|
||||
my $p = $1;
|
||||
my $c = length($p)+1;
|
||||
|
||||
my $ch = "$f:$l:$w";
|
||||
if($wl{$ch}) {
|
||||
# whitelisted
|
||||
print STDERR "$ch found but whitelisted\n";
|
||||
next;
|
||||
}
|
||||
|
||||
print STDERR "$f:$l:$c: error: found bad word \"$w\"\n";
|
||||
printf STDERR " %4d | $in\n", $l;
|
||||
printf STDERR " | %*s^%s\n", length($p), " ",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue