| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DMOSS::Plugin::FunctionIdsDoc; |
|
2
|
|
|
|
|
|
|
$DMOSS::Plugin::FunctionIdsDoc::VERSION = '0.01_2'; |
|
3
|
|
|
|
|
|
|
# ABSTRACT: DMOSS number identifiers found in docs plugin |
|
4
|
1
|
|
|
1
|
|
6
|
use parent qw/DMOSS::Plugin/; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
8
|
|
|
5
|
1
|
|
|
1
|
|
67
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
50
|
|
|
6
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
219
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
7
|
use File::Slurp qw/read_file/; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
1471
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @types = qw/_SOURCE/; |
|
11
|
|
|
|
|
|
|
|
|
12
|
0
|
|
|
0
|
1
|
|
sub name { 'Function Identifiers Found in Documentation' } |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $TMPDIR = '/tmp'; # FIXME |
|
15
|
|
|
|
|
|
|
sub process { |
|
16
|
0
|
|
|
0
|
1
|
|
my ($self, $dmoss, $file) = @_; |
|
17
|
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $run = "curl -s -F \"upload_file=\@".$file->fullpath.';filename='.$file->path."\" http://conclave.di.uminho.pt/clang/ws"; |
|
19
|
0
|
|
|
|
|
|
my $res = `$run`; |
|
20
|
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my @ids; |
|
22
|
0
|
|
|
|
|
|
foreach (split /\n+/, $res) { |
|
23
|
0
|
0
|
|
|
|
|
if ($_ =~ m/^Function/) { |
|
24
|
0
|
|
|
|
|
|
my @l = split /,/, $_; |
|
25
|
0
|
|
|
|
|
|
push @ids, $l[2]; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $corpus = join('/', $TMPDIR, $dmoss->{meta}->{dist}) . '.txt'; |
|
30
|
0
|
0
|
|
|
|
|
unless (-e $corpus) { |
|
31
|
0
|
|
|
|
|
|
`dmoss-corpus $dmoss->{basedir} > $corpus`; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $content = read_file $corpus; |
|
35
|
0
|
|
|
|
|
|
my $found = 0; |
|
36
|
0
|
|
|
|
|
|
foreach (@ids) { |
|
37
|
0
|
0
|
|
|
|
|
$found++ if ($content =~ m/\b$_\b/); |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
$dmoss->add_attr('ids', {found=>$found, total=>scalar(@ids) } ); |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub reduce { |
|
44
|
0
|
|
|
0
|
1
|
|
my ($self, $dmoss, @attrs) = @_; |
|
45
|
0
|
|
|
|
|
|
my ($total, $found) = (0, 0); |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
foreach (@attrs) { |
|
48
|
0
|
|
|
|
|
|
$total += $_->value->{total}; |
|
49
|
0
|
|
|
|
|
|
$found += $_->value->{found}; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
$dmoss->add_attr('ids', {found=>$found, total=>$total} ); |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub report { |
|
56
|
0
|
|
|
0
|
1
|
|
my ($self, $dmoss, $attr) = @_; |
|
57
|
0
|
0
|
0
|
|
|
|
return unless ($attr->value and keys %{$attr->value}); |
|
|
0
|
|
|
|
|
|
|
|
58
|
0
|
0
|
|
|
|
|
return unless $attr->value->{total}; |
|
59
|
0
|
|
|
|
|
|
my ($found, $total) = ($attr->value->{found}, $attr->value->{total}); |
|
60
|
|
|
|
|
|
|
|
|
61
|
0
|
0
|
|
|
|
|
my $p = $total ? int($found/$total*100) : 0; |
|
62
|
0
|
|
|
|
|
|
return [ $attr->file->path, $found, $total, "$p%" ]; |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub report_headers { |
|
67
|
0
|
|
|
0
|
1
|
|
my ($self, $dmoss) = @_; |
|
68
|
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
return [ '', 'Ids Found', 'Total Ids', '% Found' ]; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub grade { |
|
73
|
0
|
|
|
0
|
1
|
|
my ($self, $dmoss, $attr) = @_; |
|
74
|
0
|
|
|
|
|
|
my ($found, $total) = ($attr->value->{found}, $attr->value->{total}); |
|
75
|
|
|
|
|
|
|
|
|
76
|
0
|
0
|
|
|
|
|
return ($total ? ($found/$total) : 0); |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__ |