-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathcheck-wrong-params
More file actions
executable file
·62 lines (44 loc) · 1.1 KB
/
Copy pathcheck-wrong-params
File metadata and controls
executable file
·62 lines (44 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env perl
use 5.30.0;
use strict;
use warnings;
use open ':std', ':utf8', ':encoding(UTF-8)';
# no feature qw(indirect);
use feature qw(signatures);
no warnings qw(experimental::signatures);
use Getopt::Long;
use Pod::Usage;
use DBI;
my $dbPath = "jass.db";
my $help = 0;
GetOptions(
"db=s" => \$dbPath,
help => \$help
) or die pod2usage( -verbose => 1 );
pod2usage( -verbose => 2 ) if $help;
pod2usage( -verbose => 1 ) if @ARGV;
my $dbh = DBI->connect("DBI:SQLite:$dbPath");
my $stmt = $dbh->prepare(<<'SQL');
SELECT fnname, param
FROM parameters
WHERE param NOT IN (
SELECT param
FROM params_extra
WHERE params_extra.fnname = parameters.fnname
);
SQL
$stmt->execute();
my $cnt = 0;
while (my $row = $stmt->fetchrow_hashref() ) {
say STDERR $row->{fnname}, ' has wrong @param annotation ', $row->{param};
$cnt++;
}
exit 1 if $cnt;
__END__
=head1 NAME
check-wrong-params - checks if there are any mismatched @param annotations
=head1 SYNOPSIS
check-wrong-params [options]
Options:
--db Path to jass.db. Default: jass.db
--help Prints this help message