mirror of
https://github.com/curl/curl.git
synced 2024-11-21 01:16:58 +08:00
checksrc: introduce a whitelisting concept
This commit is contained in:
parent
9395999543
commit
0037eb5805
@ -26,13 +26,31 @@ my $indent = 2;
|
||||
|
||||
my $warnings;
|
||||
my $errors;
|
||||
my $supressed; # whitelisted problems
|
||||
my $file;
|
||||
my $dir=".";
|
||||
my $wlist;
|
||||
|
||||
my %whitelist;
|
||||
|
||||
sub readwhitelist {
|
||||
open(W, "<checksrc.whitelist");
|
||||
my @all=<W>;
|
||||
for(@all) {
|
||||
chomp;
|
||||
$whitelist{$_}=1;
|
||||
}
|
||||
close(W);
|
||||
}
|
||||
|
||||
sub checkwarn {
|
||||
my ($num, $col, $file, $line, $msg, $error) = @_;
|
||||
|
||||
if($whitelist{$line}) {
|
||||
$supressed++;
|
||||
return;
|
||||
}
|
||||
|
||||
my $w=$error?"error":"warning";
|
||||
|
||||
if($w) {
|
||||
@ -78,6 +96,8 @@ if(!$file) {
|
||||
exit;
|
||||
}
|
||||
|
||||
readwhitelist();
|
||||
|
||||
do {
|
||||
if("$wlist" !~ / $file /) {
|
||||
my $fullname = $file;
|
||||
|
6
lib/checksrc.whitelist
Normal file
6
lib/checksrc.whitelist
Normal file
@ -0,0 +1,6 @@
|
||||
227 Entering Passive Mode (a1,a2,a3,a4,p1,p2)
|
||||
228 Entering Long Passive Mode (4,4,a1,a2,a3,a4,2,p1,p2)
|
||||
150 ASCII data connection for /bin/ls (137.167.104.91,37445) (0 bytes).
|
||||
150 Opening ASCII mode data connection for [file] (0.0.0.0,0) (545 bytes)
|
||||
* no_proxy=domain1.dom,host.domain2.dom
|
||||
Default values are (0,0) initialized by calloc.
|
3
src/checksrc.whitelist
Normal file
3
src/checksrc.whitelist
Normal file
@ -0,0 +1,3 @@
|
||||
* 'name=@filename,filename2,filename3'
|
||||
* 'name=@filename;type=image/gif,filename2,filename3'
|
||||
|
Loading…
Reference in New Issue
Block a user