checkstyle9: Remove irrelevant stuff from qemu

Remove some qemu project specific things we don't care about

o Remove python interpreter check
o Remove linux header check
o Remove trace file specail treatment
o Add $FreeBSD$ tag additions
o Remove some experiemntal code we won't need
o Remove commented out initializer code that we don't explicitly have a
  rule for.

Sponsored by:		Netflix
This commit is contained in:
Warner Losh 2024-01-07 09:14:13 -07:00
parent 7d35b38972
commit 1e81724578

View File

@ -170,8 +170,6 @@ if ($color =~ /^always$/i) {
my $dbg_values = 0;
my $dbg_possible = 0;
my $dbg_type = 0;
my $dbg_attr = 0;
my $dbg_adv_dcs = 0;
my $dbg_adv_checking = 0;
my $dbg_adv_apw = 0;
@ -1436,17 +1434,12 @@ sub process {
}
}
# Only allow Python 3 interpreter
if ($realline == 1 &&
$line =~ /^\+#!\ *\/usr\/bin\/(?:env )?python$/) {
ERROR("please use python3 interpreter\n" . $herecurr);
}
# Accept git diff extended headers as valid patches
if ($line =~ /^(?:rename|copy) (?:from|to) [\w\/\.\-]+\s*$/) {
$is_patch = 1;
}
# Filter out bad email addresses.
if ($line =~ /^(Author|From): .*noreply.*/) {
ERROR("Real email adress is needed\n" . $herecurr);
}
@ -1512,9 +1505,6 @@ sub process {
# ignore non-hunk lines and lines being removed
next if (!$hunk_line || $line =~ /^-/);
# ignore files that are being periodically imported from Linux
next if ($realfile =~ /^(linux-headers|include\/standard-headers)\//);
#trailing whitespace
if ($line =~ /^\+.*\015/) {
my $herevet = "$here\n" . cat_vet($rawline) . "\n";
@ -1536,26 +1526,6 @@ sub process {
$rpt_cleaners = 1;
}
# checks for trace-events files
if ($realfile =~ /trace-events$/ && $line =~ /^\+/) {
if ($rawline =~ /%[-+ 0]*#/) {
ERROR("Don't use '#' flag of printf format ('%#') in " .
"trace-events, use '0x' prefix instead\n" . $herecurr);
} else {
my $hex =
qr/%[-+ *.0-9]*([hljztL]|ll|hh)?(x|X|"\s*PRI[xX][^"]*"?)/;
# don't consider groups splitted by [.:/ ], like 2A.20:12ab
my $tmpline = $rawline;
$tmpline =~ s/($hex[.:\/ ])+$hex//g;
if ($tmpline =~ /(?<!0x)$hex/) {
ERROR("Hex numbers must be prefixed with '0x'\n" .
$herecurr);
}
}
}
# check we are in a valid source file if not then ignore this hunk
next if ($realfile !~ /$SrcFile/);
@ -1584,7 +1554,7 @@ sub process {
}
# check for RCS/CVS revision markers
if ($rawline =~ /^\+.*\$(Revision|Log|Id)(?:\$|\b)/) {
if ($rawline =~ /^\+.*\$(FreeBSD|Revision|Log|Id)(?:\$|\b)/) {
ERROR("CVS style keyword markers, these will _not_ be updated\n". $herecurr);
}
@ -1886,25 +1856,6 @@ sub process {
#ignore lines not being added
if ($line=~/^[^\+]/) {next;}
# TEST: allow direct testing of the type matcher.
if ($dbg_type) {
if ($line =~ /^.\s*$Declare\s*$/) {
ERROR("TEST: is type\n" . $herecurr);
} elsif ($dbg_type > 1 && $line =~ /^.+($Declare)/) {
ERROR("TEST: is not type ($1 is)\n". $herecurr);
}
next;
}
# TEST: allow direct testing of the attribute matcher.
if ($dbg_attr) {
if ($line =~ /^.\s*$Modifier\s*$/) {
ERROR("TEST: is attr\n" . $herecurr);
} elsif ($dbg_attr > 1 && $line =~ /^.+($Modifier)/) {
ERROR("TEST: is not attr ($1 is)\n". $herecurr);
}
next;
}
# check for initialisation to aggregates open brace on the next line
if ($line =~ /^.\s*\{/ &&
$prevline =~ /(?:^|[^=])=\s*$/) {
@ -1928,17 +1879,6 @@ sub process {
$line =~ s@//.*@@;
$opline =~ s@//.*@@;
# check for global initialisers.
# if ($line =~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=\s*(0|NULL|false)\s*;/) {
# ERROR("do not initialise globals to 0 or NULL\n" .
# $herecurr);
# }
# check for static initialisers.
# if ($line =~ /\bstatic\s.*=\s*(0|NULL|false)\s*;/) {
# ERROR("do not initialise statics to 0 or NULL\n" .
# $herecurr);
# }
# * goes on variable not on type
# (char*[ const])
if ($line =~ m{\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\)}) {