Analizo.pm

filter: Statementstmt 77.7% 21 / 27 Branchbran 66.6% 4 / 6 Conditioncond 66.6% 4 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 87.5% 7 / 8 Podpod 50.0% 2 / 4 totaltotal 70.9% 39 / 55 CC 6 SCAR 9.9
CC
6
Cov
74%
prepare_args
6.0
config
3.0
load_command_options
3.0
CRAP 2.7
« Analizo/Metric/LackOfCohesionOfMethods.pm ↑ Summary Analizo/Filter/Client.pm »
1 package Analizo;
2 18 ▶use App::Cmd::Setup -app;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 18 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 18 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 18 ▶use local::lib;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 18 our $VERSION = '1.25.5';
8  
9 =head1 NAME
10  
11 analizo - multi-language source code analysis toolkit
12  
13 =head1 USAGE
14  
15 analizo <tool> [tool-options] <toolargs> [<tool-args> ...]
16 analizo <option>
17  
18 =cut
19  
20 21 ▶sub global_opt_spec {
Subroutine global_opt_spec: called CC=1 SCAR=0.0
Pod documented
21 return (
22 21 [ 'help|h', 'displays the help (full manpage)' ],
23 [ 'usage', 'displays the usage of the command' ],
24 [ 'version|v', 'displays version information' ],
25 );
26 }
27  
28 5 ▶sub config {
Subroutine config: called CC=3 SCAR=11.1
Pod undocumented
29 5 my ($self) = @_;
30 5 ▶ $self->{config} ||= (-e '.analizo'
Branch: 1 branch
BranchTrueFalseTotal
-e '.analizo' ? : 3 1 4
Condition66%2/3
$self->{"config"} ||= -e ".analizo" ? YAML::XS::LoadFile(".analizo") : {}
l!l&&r!l&&!r
140
MC/DC0%0/2
$self->{"config"} ||= -e ".analizo" ? YAML::XS::LoadFile(".analizo") : {}
$self->{"config"} -e ".analizo" ? YAML::XS::LoadFile(".analizo") : {}
Truth table66%2/3
A ||= B
A= $self->{"config"}B= -e ".analizo" ? YAML::XS::LoadFile(".analizo") : {}
ABresult
1X1
011
000
31 ? YAML::XS::LoadFile('.analizo')
32 : {}
33 );
34 }
35  
36 2 ▶sub load_command_options {
Subroutine load_command_options: called CC=3 SCAR=11.0
Pod undocumented
37 2 my ($self, $command) = @_;
38 2 ▶ if ($command && $self->config->{$command}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($command and $self->config->{$command}) { } 1 1 2
Condition66%2/3
$command and $self->config->{$command}
!ll&&!rl&&r
011
MC/DC50%1/2
$command and $self->config->{$command}
$command $self->config->{$command}
Truth table66%2/3
A and B
A= $commandB= $self->config->{$command}
ABresult
0X0
100
111
39 1 split(/\s+/, $self->config->{$command});
40 }
41 else {
42 1 ();
43 }
44 }
45  
46 0 ▶sub prepare_args {
Subroutine prepare_args: not called CC=2 SCAR=17.9
Pod documented
47 0 my ($self) = @_;
48 0 ▶ if (@ARGV) {
Branch: 1 branch
BranchTrueFalseTotal
if (@ARGV) 0 0 0
49 0 my $command = shift @ARGV;
50 0 my @options = $self->load_command_options($command);
51 0 unshift @ARGV, $command, @options;
52 }
53 0 (@ARGV);
54 }
55  
56 18 1;
57  
58 =head1 DESCRIPTION
59  
60 analizo is a suite of source code analysis tools, aimed at being
61 language-independent and extensible. The 'analizo' program is a wrapper for the
62 analizo tools, which do the real work, so most of the time you'll be using one
63 specific tool among the available ones. See TOOLS below for more information.
64  
65 =head1 TOOLS
66  
67 analizo has several individual tools that share a core infrastructure, but do
68 different analysis and produce different output. They are normally invoked like
69 this:
70  
71 analizo <tool> [tool-options] <tool-args> [<tool-args> ...]
72  
73 Although you can invoke analizo tools against one or few files inside a project,
74 normally it only makes sense to run it against the entire source tree (e.g.
75 passing "." or "./src" as input directories).
76  
77 The options and output are specific to each tool, so make sure to read the
78 corresponding manual for the tool(s) you want.
79  
80 Run B<analizo> without any command line arguments to see the list of available
81 tools.
82  
83 =head1 OPTIONS
84  
85 The following are the options for the wrapper analizo script. The options for
86 each tools are documented in the respective tool's manual page.
87  
88 =over
89  
90 =item --version, -v
91  
92 Displays version information and exits.
93  
94 =item --help, -h
95  
96 Displays the manpage for the 'analizo' script or any analizo 'tool'.
97  
98 =item --usage
99  
100 Displays the only usage of the named tool, instead of display its manpage.
101  
102 =back
103  
104 =head1 CONFIGURATION FILE
105  
106 Analizo can be configured in a per-project way by means of a file called
107 I<.analizo> in the current directory. The syntax for this file is: one line per
108 tool, each line has the tool name, a colon and one or more command line
109 options:
110  
111 <tool-name>: OPTIONS
112  
113 When you run an analizo tool from inside that directory, it will load
114 I<.analizo> and act as if the options specified there were actually passed to
115 it in the command line. Note that options in the command line will override any
116 options in configuration files, though.
117  
118 Example:
119  
120 metrics: --language cpp
121 graph: --modules
122  
123 You can store a file like that in the root directory of your project. Every
124 time you run B<analizo metrics> from that directory, it will only consider C++
125 code. When you run B<analizo graph> from that directory it will use the
126 I<--modules> option.
127  
128 =head1 HISTORY
129  
130 Analizo started as a modified version of egypt, by Andreas Gustafsson
131 (available at http://www.gson.org/egypt/ as of the time this is being written).
132 But since then so many features were added (and removed) that at some point
133 during October 2009 it felt like it wasn't egypt anymore, and a new name was
134 needed. The project was then renamed to Analizo, which means "analysis" in
135 Esperanto.
136  
137 It was also relicensed under the GPL version 3. This relicensing was possible
138 because the license of the original egypt allows that: "the same terms as Perl
139 itself" mean either Artistic License or GPL version 1 or later.
140  
141 =head1 COPYRIGHT
142  
143 =over
144  
145 =item Copyright (c) 1994-2006 Andreas Gustafsson
146  
147 =item Copyright (c) 2008-2010 Antonio Terceiro
148  
149 =item Copyright (c) 2014-2021 Joenio Marques da Costa
150  
151 =back
152  
153 This program is free software: you can redistribute it and/or modify
154 it under the terms of the GNU General Public License as published by
155 the Free Software Foundation, either version 3 of the License, or
156 (at your option) any later version.
157  
158 =head1 AUTHORS
159  
160 Andreas Gustafsson wrote the original version of analizo. Since them several
161 people contributed to analizo's development. See the AUTHORS file for a complete
162 list.
163  
164 =cut
« Analizo/Metric/LackOfCohesionOfMethods.pm ↑ Summary Analizo/Filter/Client.pm »