| 1 | package Analizo::Command::files_graph; | ||||||||||||||||||||||||||||
| 2 | 9 | ▶ | use Analizo -command; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 9 | ▶ | use parent qw(Analizo::Command); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 9 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 9 | ▶ | use Analizo::Extractor; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 9 | ▶ | use Graph::Writer::Dot; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 9 | ▶ | use File::Basename; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | # ABSTRACT: dependency graph generator among files | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | =head1 NAME | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | analizo-files-graph - dependency graph generator among files | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | =head1 USAGE | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | analizo files-graph [OPTIONS] <input> [<input> [<input> ...]] | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | =cut | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 2 | ▶ | sub usage_desc { "%c files-graph %o <input> [<input> [<input> ...]]" } | ||||||||||||||||||||||||||
|
Subroutine
usage_desc: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 26 | ▶ | sub command_names { qw/files-graph/ } | ||||||||||||||||||||||||||
|
Subroutine
command_names: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 2 | ▶ | sub opt_spec { | ||||||||||||||||||||||||||
|
Subroutine
opt_spec: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 27 | return ( | ||||||||||||||||||||||||||||
| 28 | 2 | [ 'output|o=s', 'output file name' ], | |||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | sub validate { | ||||||||||||||||||||||||||
|
Subroutine
validate: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 33 | 0 | my ($self, $opt, $args) = @_; | |||||||||||||||||||||||||||
| 34 | 0 | ▶ | $self->usage_error("No input files!") unless @$args; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 0 | ▶ | my @unreadable = grep { ! -r $_ || ! -e $_ } @$args; | ||||||||||||||||||||||||||
|
Condition0%0/3
-r $_ && -e $_
MC/DC0%0/2
-r $_ && -e $_
-r $_
-e $_
Truth table0%0/3
A && B
A= -r $_B= -e $_
| |||||||||||||||||||||||||||||
| 36 | 0 | ▶ | if (@unreadable) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | 0 | foreach my $file (@unreadable) { | |||||||||||||||||||||||||||
| 38 | 0 | $self->usage_error("$file is not readable"); | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | 0 | ▶ | if ($opt->output && ! -w dirname($opt->output)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$opt->output and not -w dirname($opt->output)
MC/DC0%0/2
$opt->output and not -w dirname($opt->output)
$opt->output
not -w dirname($opt->output)
Truth table0%0/3
A and not(B)
A= $opt->outputB= not -w dirname($opt->output)
| |||||||||||||||||||||||||||||
| 42 | 0 | $self->usage_error("No such file or directory"); | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 0 | ▶ | sub execute { | ||||||||||||||||||||||||||
|
Subroutine
execute: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 47 | 0 | my ($self, $opt, $args) = @_; | |||||||||||||||||||||||||||
| 48 | 0 | my $extractor = Analizo::Extractor->load('Doxyparse'); | |||||||||||||||||||||||||||
| 49 | 0 | $extractor->process(@$args); | |||||||||||||||||||||||||||
| 50 | 0 | my $graph = $extractor->model->files_graph; | |||||||||||||||||||||||||||
| 51 | 0 | ▶ | if ($opt->output) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | 0 | ▶ | open STDOUT, '>', $opt->output or die "$!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | 0 | my $stdout = \*STDOUT; | |||||||||||||||||||||||||||
| 55 | 0 | my $graph_writer = Graph::Writer::Dot->new; | |||||||||||||||||||||||||||
| 56 | 0 | $graph_writer->write_graph($graph, $stdout); | |||||||||||||||||||||||||||
| 57 | 0 | close STDOUT; | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | analizo files-graph reads the dependency information from one or more source code | ||||||||||||||||||||||||||||
| 63 | directories passed as arguments, and produces as output the graph of | ||||||||||||||||||||||||||||
| 64 | dependencies between the files of the software in the graphviz(1) format. | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | analizo files-graph is part of the analizo suite and was implemented to | ||||||||||||||||||||||||||||
| 67 | represent the old analizo dsm output tool in a textual format, as the dsm tool | ||||||||||||||||||||||||||||
| 68 | is going to be removed from analizo suite. The dependency graph includes | ||||||||||||||||||||||||||||
| 69 | relationships among files including function calls, inheritances and attribute | ||||||||||||||||||||||||||||
| 70 | use. | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | analizo files-graph is part of the analizo suite. | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | =head1 REQUIRED ARGUMENTS | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | =over | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | =item <input>... | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | The input directories (or files) with source code to be processed. | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | Although you can pass individual files as input, this tool is more useful if | ||||||||||||||||||||||||||||
| 83 | you pass entire source directories. | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | =back | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | =head1 OPTIONS | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | =over | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | =item --output <file>, -o <file> | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | Use a file as output | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | =back | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | =head1 VIEWING THE GRAPH | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | See B<analizo-graph(1)>. | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | =head1 READING THE GRAPH | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | See B<analizo-graph(1)>. | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | B<dotty(1)>, B<dot(1)>, B<neato(1)>, B<analizo(1)> | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | =head1 COPYRIGHT AND AUTHORS | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | See B<analizo(1)>. | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | =cut | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 9 | 1; | |||||||||||||||||||||||||||