tidy-up: add spaces around equal operators where missing

Found via regex search: `=[^~>= ]`

Closes #21975
This commit is contained in:
Viktor Szakats 2026-06-11 17:22:30 +02:00
parent 2a606c68fa
commit e35ba09f47
No known key found for this signature in database
56 changed files with 593 additions and 596 deletions

View file

@ -184,14 +184,14 @@ while(<CONFIG>) {
if(/^---:([^:]*):(.*)/) {
# whitelist file + word
my $word = lc($2);
$wl{"$1:$word"}=1;
$wl{"$1:$word"} = 1;
}
elsif($_ =~ /^---(.+)/) {
# whitelist word
push @whitelist, $1;
}
elsif($_ =~ /^(.*)([:=])(.*)/) {
my ($bad, $sep, $better)=($1, $2, $3);
my ($bad, $sep, $better) = ($1, $2, $3);
if($sep eq "=") {
$alt{$bad} = $better;
push @exact, $bad;

View file

@ -79,7 +79,7 @@ sub outseealso {
sub single {
my @head;
my @seealso;
my ($f)=@_;
my ($f) = @_;
my $title;
my $section;
my $source;
@ -103,13 +103,13 @@ sub single {
next;
}
if(/^Title: *(.*)/i) {
$title=$1;
$title = $1;
}
elsif(/^Section: *(.*)/i) {
$section=$1;
$section = $1;
}
elsif(/^Source: *(.*)/i) {
$source=$1;
$source = $1;
}
elsif(/^See-also: +(.*)/i) {
$salist = 0;
@ -130,10 +130,10 @@ sub single {
}
# REUSE-IgnoreStart
elsif(/^C: (.*)/i) {
$copyright=$1;
$copyright = $1;
}
elsif(/^SPDX-License-Identifier: (.*)/i) {
$spdx=$1;
$spdx = $1;
}
# REUSE-IgnoreEnd
elsif(/^---/) {

View file

@ -199,7 +199,7 @@ sub single {
my @proto;
my @tls;
my $d;
my ($f)=@_;
my ($f) = @_;
my $copyright;
my $errors = 0;
my $fh;
@ -234,13 +234,13 @@ sub single {
next;
}
if(/^Title: *(.*)/i) {
$title=$1;
$title = $1;
}
elsif(/^Section: *(.*)/i) {
$section=$1;
$section = $1;
}
elsif(/^Source: *(.*)/i) {
$source=$1;
$source = $1;
}
elsif(/^See-also: +(.*)/i) {
$list = 1; # 1 for see-also
@ -260,7 +260,7 @@ sub single {
$list = 3; # 3 for TLS backend
}
elsif(/^Added-in: *(.*)/i) {
$addedin=$1;
$addedin = $1;
if(($addedin !~ /^[0-9.]+[0-9]\z/) &&
($addedin ne "n/a")) {
print STDERR "$f:$line:1:ERROR: invalid version number in Added-in line: $addedin\n";
@ -285,10 +285,10 @@ sub single {
}
# REUSE-IgnoreStart
elsif(/^C: (.*)/i) {
$copyright=$1;
$copyright = $1;
}
elsif(/^SPDX-License-Identifier: (.*)/i) {
$spdx=$1;
$spdx = $1;
}
# REUSE-IgnoreEnd
elsif(/^---/) {

View file

@ -29,7 +29,7 @@ use strict;
use warnings;
sub convert {
my ($dir)=@_;
my ($dir) = @_;
opendir(my $dh, $dir) || die "could not open $dir";
my @cd = grep { /\.md\z/ && -f "$dir/$_" } readdir($dh);
closedir $dh;

View file

@ -35,8 +35,8 @@ my $errors = 0;
my $serrors = 0;
my $suppressed; # skipped problems
my $file;
my $dir=".";
my $wlist="";
my $dir = ".";
my $wlist = "";
my @alist;
my $windows_os = $^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys';
my $verbose = 0;
@ -206,10 +206,10 @@ my %warnings = (
sub readskiplist {
open(my $W, '<', "$dir/checksrc.skip") or return;
my @all=<$W>;
my @all = <$W>;
for(@all) {
$windows_os ? $_ =~ s/\r?\n$// : chomp;
$skiplist{$_}=1;
$skiplist{$_} = 1;
}
close($W);
}
@ -431,8 +431,8 @@ sub accept_violations {
print "'$r' is not a warning to accept!\n";
exit;
}
$ignore{$r}=999999;
$ignore_used{$r}=0;
$ignore{$r} = 999999;
$ignore_used{$r} = 0;
}
}
@ -463,9 +463,9 @@ sub enable_warn {
$line, length($what) + 11, $file, $l,
"No warning was inhibited!");
}
$ignore_set{$what}=0;
$ignore_used{$what}=0;
$ignore{$what}=0;
$ignore_set{$what} = 0;
$ignore_used{$what} = 0;
$ignore{$what} = 0;
}
sub checksrc {
my ($cmd, $line, $file, $l) = @_;
@ -474,9 +474,9 @@ sub checksrc {
$what =~ s: *\*/$::; # cut off end of C comment
# print "ENABLE $enable WHAT $what\n";
if($enable eq "disable") {
my ($warn, $scope)=($1, $2);
my ($warn, $scope) = ($1, $2);
if($what =~ /([^ ]*) +(.*)/) {
($warn, $scope)=($1, $2);
($warn, $scope) = ($1, $2);
}
else {
$warn = $what;
@ -484,7 +484,7 @@ sub checksrc {
}
# print "IGNORE $warn for SCOPE $scope\n";
if($scope eq "all") {
$scope=999999;
$scope = 999999;
}
# Comparing for a literal zero rather than the scalar value zero
@ -502,9 +502,9 @@ sub checksrc {
"$warn already disabled from line $ignore_set{$warn}");
}
else {
$ignore{$warn}=$scope;
$ignore_set{$warn}=$line;
$ignore_line[$line]=$l;
$ignore{$warn} = $scope;
$ignore_set{$warn} = $line;
$ignore_line[$line] = $l;
}
}
elsif($enable eq "enable") {
@ -528,8 +528,8 @@ sub scanfile {
my ($file) = @_;
my $line = 1;
my $prevl="";
my $prevpl="";
my $prevl = "";
my $prevpl = "";
my $l = "";
my $prep = 0;
my $prevp = 0;
@ -542,8 +542,8 @@ sub scanfile {
open(my $R, '<', $file) || die "failed to open $file";
my $incomment=0;
my @copyright=();
my $incomment = 0;
my @copyright = ();
my %includes;
checksrc_clear(); # for file based ignores
accept_violations();
@ -649,7 +649,7 @@ sub scanfile {
}
else {
# still within a comment
$l="";
$l = "";
}
}
@ -702,7 +702,7 @@ sub scanfile {
my $nostr = nostrings($l);
# check spaces after for/if/while/function call
if($nostr =~ /^(.*)(for|if|while|switch| ([a-zA-Z0-9_]+)) \((.)/) {
my ($leading, $word, $extra, $first)=($1,$2,$3,$4);
my ($leading, $word, $extra, $first) = ($1, $2, $3, $4);
if($1 =~ / *\#/) {
# this is a #if, treat it differently
}
@ -898,15 +898,15 @@ sub scanfile {
# check for comma without space
if($l =~ /^(.*),[^ \n]/) {
my $pref=$1;
my $ign=0;
my $pref = $1;
my $ign = 0;
if($pref =~ / *\#/) {
# this is a #if, treat it differently
$ign=1;
$ign = 1;
}
elsif($pref =~ /\/\*/) {
# this is a comment
$ign=1;
$ign = 1;
}
elsif($pref =~ /[\"\']/) {
$ign = 1;

View file

@ -66,7 +66,7 @@ my $indent = 4;
# get the long name version, return the man page string
sub manpageify {
my ($k, $manpage)=@_;
my ($k, $manpage) = @_;
my $trail = '';
# the matching pattern might include a trailing dot that cannot be part of
# the option name
@ -85,7 +85,7 @@ sub manpageify {
return "--$k$trail";
}
my $colwidth=79; # max number of columns
my $colwidth = 79; # max number of columns
sub prefixline {
my ($num) = @_;
@ -220,7 +220,7 @@ sub printdesc {
}
sub seealso {
my($standalone, $data)=@_;
my($standalone, $data) = @_;
if($standalone) {
return sprintf
".SH \"SEE ALSO\"\n$data\n";
@ -231,7 +231,7 @@ sub seealso {
}
sub overrides {
my ($standalone, $data)=@_;
my ($standalone, $data) = @_;
if($standalone) {
return ".SH \"OVERRIDES\"\n$data\n";
}
@ -263,7 +263,7 @@ my %protexists = (
);
sub protocols {
my ($f, $line, $manpage, $standalone, $data)=@_;
my ($f, $line, $manpage, $standalone, $data) = @_;
my @e = split(/ +/, $data);
for my $pr (@e) {
if(!$protexists{$pr}) {
@ -282,7 +282,7 @@ sub protocols {
}
sub too_old {
my ($version)=@_;
my ($version) = @_;
my $a = 999999;
if($version =~ /^(\d+)\.(\d+)\.(\d+)/) {
$a = $1 * 1000 + $2 * 10 + $3;
@ -299,7 +299,7 @@ sub too_old {
}
sub added {
my ($standalone, $data)=@_;
my ($standalone, $data) = @_;
if(too_old($data)) {
# do not mention ancient additions
return "";
@ -560,7 +560,7 @@ sub maybespace {
}
sub single {
my ($dir, $manpage, $f, $standalone)=@_;
my ($dir, $manpage, $f, $standalone) = @_;
my $fh;
open($fh, "<:crlf", "$dir/$f") ||
die "could not find $dir/$f";
@ -597,28 +597,28 @@ sub single {
next;
}
if(/^Short: *(.)/i) {
$short=$1;
$short = $1;
}
elsif(/^Long: *(.*)/i) {
$long=$1;
$long = $1;
}
elsif(/^Added: *(.*)/i) {
$added=$1;
$added = $1;
}
elsif(/^Tags: *(.*)/i) {
$tags=$1;
$tags = $1;
}
elsif(/^Arg: *(.*)/i) {
$arg=$1;
$arg = $1;
}
elsif(/^Magic: *(.*)/i) {
$magic=$1;
$magic = $1;
}
elsif(/^Mutexed: *(.*)/i) {
$mutexed=$1;
$mutexed = $1;
}
elsif(/^Protocols: *(.*)/i) {
$protocols=$1;
$protocols = $1;
}
elsif(/^See-also: +(.+)/i) {
if(@seealso) {
@ -628,16 +628,16 @@ sub single {
push @seealso, $1;
}
elsif(/^See-also:/i) {
$list=2;
$list = 2;
}
elsif(/^ *- (.*)/i && ($list == 2)) {
push @seealso, $1;
}
elsif(/^Requires: *(.*)/i) {
$requires=$1;
$requires = $1;
}
elsif(/^Category: *(.*)/i) {
$category=$1;
$category = $1;
}
elsif(/^Example: +(.+)/i) {
push @examples, $1;
@ -650,20 +650,20 @@ sub single {
push @examples, $1;
}
elsif(/^Multi: *(.*)/i) {
$multi=$1;
$multi = $1;
}
elsif(/^Scope: *(.*)/i) {
$scope=$1;
$scope = $1;
}
elsif(/^Experimental: yes/i) {
$experimental=1;
$experimental = 1;
}
# REUSE-IgnoreStart
elsif(/^C: (.*)/i) {
$copyright=$1;
$copyright = $1;
}
elsif(/^SPDX-License-Identifier: (.*)/i) {
$spdx=$1;
$spdx = $1;
}
# REUSE-IgnoreEnd
elsif(/^Help: *(.*)/i) {
@ -855,7 +855,7 @@ sub single {
" is built to support $requires.\n";
}
if($mutexed) {
my @m=split(/ /, $mutexed);
my @m = split(/ /, $mutexed);
my $mstr;
my $num = scalar(@m);
my $count = 0;
@ -875,8 +875,8 @@ sub single {
"This option is mutually exclusive with $mstr.\n");
}
if($examples[0]) {
my $s ="";
$s="s" if($examples[1]);
my $s = "";
$s = "s" if($examples[1]);
foreach my $e (@examples) {
my $check = $e;
# verify the used options
@ -933,7 +933,7 @@ sub single {
if(length($e) > $maxwidth) {
$r = maybespace($r);
}
my $slash ="";
my $slash = "";
$e = substr($e, length($r));
if(length($e) > 0) {
$slash = "\\";
@ -967,7 +967,7 @@ sub single {
}
sub getshortlong {
my ($dir, $f)=@_;
my ($dir, $f) = @_;
$f =~ s/^.*\///;
open(F, "<:crlf", "$dir/$f") ||
die "could not find $dir/$f";
@ -988,13 +988,13 @@ sub getshortlong {
next;
}
if(/^Short: (.)/i) {
$short=$1;
$short = $1;
}
elsif(/^Long: (.*)/i) {
$long=$1;
$long = $1;
}
elsif(/^Help: (.*)/i) {
$help=$1;
$help = $1;
my $len = length($help);
if($len >= 49) {
printf STDERR "$f:$line:1:WARN: oversized help text: %d characters\n",
@ -1002,13 +1002,13 @@ sub getshortlong {
}
}
elsif(/^Arg: (.*)/i) {
$arg=$1;
$arg = $1;
}
elsif(/^Protocols: (.*)/i) {
$protocols=$1;
$protocols = $1;
}
elsif(/^Category: (.*)/i) {
$category=$1;
$category = $1;
}
elsif(/^---/) {
last;
@ -1016,14 +1016,14 @@ sub getshortlong {
}
close(F);
if($short) {
$optshort{$short}=$long;
$optshort{$short} = $long;
}
if($long) {
$optlong{$long}=$short;
$helplong{$long}=$help;
$arglong{$long}=$arg;
$protolong{$long}=$protocols;
$catlong{$long}=$category;
$optlong{$long} = $short;
$helplong{$long} = $help;
$arglong{$long} = $arg;
$protolong{$long} = $protocols;
$catlong{$long} = $category;
}
}
@ -1035,7 +1035,7 @@ sub indexoptions {
}
sub header {
my ($dir, $manpage, $f)=@_;
my ($dir, $manpage, $f) = @_;
my $fh;
open($fh, "<:crlf", "$dir/$f") ||
die "could not find $dir/$f";
@ -1192,7 +1192,7 @@ sub listglobals {
}
}
if(/^Long: *(.*)/i) {
$long=$1;
$long = $1;
}
elsif(/^Scope: global/i) {
push @globalopts, $long;

View file

@ -90,7 +90,7 @@ if(defined $ARGV[0] && $ARGV[0] eq "--dry-run") {
}
# list all files to scan for links
my @files=`git ls-files docs include lib scripts src`;
my @files = `git ls-files docs include lib scripts src`;
sub storelink {
my ($f, $line, $link) = @_;

View file

@ -42,7 +42,7 @@ use warnings;
my $nroff2cd = "0.1"; # to keep check
sub single {
my ($f)=@_;
my ($f) = @_;
open(F, "<:crlf", $f) ||
return 1;
my $line;

View file

@ -58,8 +58,8 @@ use strict;
use warnings;
my $cleanup = (@ARGV && $ARGV[0] eq "cleanup");
my @gitlog=`git log @^{/RELEASE-NOTES:.synced}..` if(!$cleanup);
my @releasenotes=`cat RELEASE-NOTES`;
my @gitlog = `git log @^{/RELEASE-NOTES:.synced}..` if(!$cleanup);
my @releasenotes = `cat RELEASE-NOTES`;
my @o; # the entire new RELEASE-NOTES
my @refused; # [num] = [2 bits of use info]
@ -68,7 +68,7 @@ my %dupe;
for my $l (@releasenotes) {
if($l =~ /^ o .*\[(\d+)\]/) {
# referenced, set bit 0
$refused[$1]=1;
$refused[$1] = 1;
my $m = $l;
chomp $m;
$m =~ s/^ o //;
@ -107,7 +107,7 @@ sub getref {
# 'https://elsewhere.example.com/discussion'
sub extract {
my ($ref)=@_;
my ($ref) = @_;
if($ref =~ /^(\#|)(\d+)/) {
# return the plain number
return $2;
@ -175,7 +175,7 @@ if($first) {
# call at the end of a parsed commit
sub onecommit {
my ($short)=@_;
my ($short) = @_;
my $ref = '';
if($dupe{$short}) {
@ -199,7 +199,7 @@ sub onecommit {
if($ref) {
my $r = getref();
$refs[$r] = $ref;
$moreinfo{$short}=$r;
$moreinfo{$short} = $r;
$refused[$r] |= 1;
}
}
@ -220,7 +220,7 @@ for my $l (@releasenotes) {
push @o, sprintf " o %s%s\n", $f,
$moreinfo{$f}? sprintf(" [%d]", $moreinfo{$f}): "";
if($moreinfo{$f}) {
$refused[$moreinfo{$f}]=3;
$refused[$moreinfo{$f}] = 3;
}
}
push @o, " --- new entries are listed above this ---";

View file

@ -198,13 +198,13 @@ while(<N>) {
$file = $1;
}
if($l =~ /^([0-9a-f]+) T _?(.*)/) {
my ($name)=($2);
my ($name) = ($2);
#print "Define $name in $file\n";
$file =~ s/^libcurl_la-//;
$exist{$name} = $file;
}
elsif($l =~ /^ U _?(.*)/) {
my ($name)=($1);
my ($name) = ($1);
#print "Uses $name in $file\n";
$uses{$name} .= "$file, ";
}

View file

@ -30,15 +30,15 @@ use warnings;
# Check for a command in the PATH of the test server.
#
sub checkcmd {
my ($cmd)=@_;
my ($cmd) = @_;
my @paths;
if($^O eq 'MSWin32' || $^O eq 'dos' || $^O eq 'os2') {
# PATH separator is different
@paths=(split(';', $ENV{'PATH'}));
@paths = (split(';', $ENV{'PATH'}));
}
else {
@paths=(split(':', $ENV{'PATH'}), "/usr/sbin", "/usr/local/sbin",
"/sbin", "/usr/bin", "/usr/local/bin");
@paths = (split(':', $ENV{'PATH'}), "/usr/sbin", "/usr/local/sbin",
"/sbin", "/usr/bin", "/usr/local/bin");
}
for(@paths) {
if(-x "$_/$cmd" && ! -d "$_/$cmd") {
@ -97,15 +97,15 @@ my $alllines = 0;
for my $l (@output) {
chomp $l;
if($l =~/^(\d+)\t\d+\t\d+\t\d+\t(\d+)\t([^\(]+).*: ([^ ]*)/) {
my ($score, $len, $path, $func)=($1, $2, $3, $4);
my ($score, $len, $path, $func) = ($1, $2, $3, $4);
my $allow = 0;
if($whitelist{$func} &&
($score <= $whitelist{$func})) {
$allow = 1;
}
$where{"$path:$func"}=$score;
$perm{"$path:$func"}=$allow;
$where{"$path:$func"} = $score;
$perm{"$path:$func"} = $allow;
if(($score > $cutoff) && !$allow) {
$error++;
}

View file

@ -30,15 +30,15 @@ use warnings;
# Check for a command in the PATH of the test server.
#
sub checkcmd {
my ($cmd)=@_;
my ($cmd) = @_;
my @paths;
if($^O eq 'MSWin32' || $^O eq 'dos' || $^O eq 'os2') {
# PATH separator is different
@paths=(split(';', $ENV{'PATH'}));
@paths = (split(';', $ENV{'PATH'}));
}
else {
@paths=(split(':', $ENV{'PATH'}), "/usr/sbin", "/usr/local/sbin",
"/sbin", "/usr/bin", "/usr/local/bin");
@paths = (split(':', $ENV{'PATH'}), "/usr/sbin", "/usr/local/sbin",
"/sbin", "/usr/bin", "/usr/local/bin");
}
for(@paths) {
if(-x "$_/$cmd" && ! -d "$_/$cmd") {
@ -97,15 +97,15 @@ my $alllines = 0;
for my $l (@output) {
chomp $l;
if($l =~/^(\d+)\t\d+\t\d+\t\d+\t(\d+)\t([^\(]+).*: ([^ ]*)/) {
my ($score, $length, $path, $func)=($1, $2, $3, $4);
my ($score, $length, $path, $func) = ($1, $2, $3, $4);
my $allow = 0;
if($whitelist{$func} &&
($length <= $whitelist{$func})) {
$allow = 1;
}
$where{"$path:$func"}=$length;
$perm{"$path:$func"}=$allow;
$where{"$path:$func"} = $length;
$perm{"$path:$func"} = $allow;
if(($length > $cutoff) && !$allow) {
$error++;
}