Critique.pm

filter: Statementstmt 96.5% 28 / 29 Branchbran 50.0% 1 / 2 Conditioncond 73.3% 11 / 15 MC/DCmcdc 50.0% 4 / 8 Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 83.3% 50 / 60 CC 9 SCAR 19.1
CC
9
Cov
87%
BEGIN
10.0
BEGIN
1.0
BEGIN
1.0
CRAP 6.8
« Critique/Command.pm ↑ Summary Critique/Session/File.pm »
1 package App::Critique;
2  
3 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 16 ▶use File::HomeDir ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7 16 ▶use JSON::XS ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 16 our $VERSION = '0.03';
10 16 our $AUTHORITY = 'cpan:STEVAN';
11  
12 # load our CONFIG first, ...
13  
14 16 our %CONFIG;
15 BEGIN {
16 16 ▶ $CONFIG{'HOME'} = $ENV{'CRITIQUE_HOME'} || File::HomeDir->my_home;
Subroutine BEGIN: called CC=9 SCAR=23.0
Condition33%1/3
$ENV{'CRITIQUE_HOME'} || 'File::HomeDir'->my_home
l!l&&r!l&&!r
0160
MC/DC0%0/2
$ENV{'CRITIQUE_HOME'} || 'File::HomeDir'->my_home
$ENV{'CRITIQUE_HOME'} 'File::HomeDir'->my_home
Truth table33%1/3
A || B
A= $ENV{'CRITIQUE_HOME'}B= 'File::HomeDir'->my_home
ABresult
1X1
011
000
17 16 ▶ $CONFIG{'COLOR'} = $ENV{'CRITIQUE_COLOR'} // 1;
Condition100%2/2
$ENV{"CRITIQUE_COLOR"} // 1
l!l
115
MC/DC100%1/1
$ENV{"CRITIQUE_COLOR"} // 1
$ENV{"CRITIQUE_COLOR"}
Truth table100%2/2
A
A= $ENV{"CRITIQUE_COLOR"}
Aresult
11
00
18 16 ▶ $CONFIG{'DEBUG'} = $ENV{'CRITIQUE_DEBUG'} // 0;
Condition100%2/2
$ENV{"CRITIQUE_DEBUG"} // 0
l!l
115
MC/DC100%1/1
$ENV{"CRITIQUE_DEBUG"} // 0
$ENV{"CRITIQUE_DEBUG"}
Truth table100%2/2
A
A= $ENV{"CRITIQUE_DEBUG"}
Aresult
11
00
19 16 ▶ $CONFIG{'VERBOSE'} = $ENV{'CRITIQUE_VERBOSE'} // 0;
Condition100%2/2
$ENV{"CRITIQUE_VERBOSE"} // 0
l!l
115
MC/DC100%1/1
$ENV{"CRITIQUE_VERBOSE"} // 0
$ENV{"CRITIQUE_VERBOSE"}
Truth table100%2/2
A
A= $ENV{"CRITIQUE_VERBOSE"}
Aresult
11
00
20 16 ▶ $CONFIG{'EDITOR'} = $ENV{'CRITIQUE_EDITOR'} || $ENV{'EDITOR'} || $ENV{'VISUAL'};
Condition66%4/6
$ENV{'CRITIQUE_EDITOR'} || $ENV{'EDITOR'} || $ENV{'VISUAL'}
l!l&&r!l&&!r
1015
$ENV{"CRITIQUE_EDITOR"} or $ENV{"EDITOR"}
l!l&&r!l&&!r
1015
MC/DC33%1/3
$ENV{'CRITIQUE_EDITOR'} || $ENV{'EDITOR'} || $ENV{'VISUAL'}
$ENV{"CRITIQUE_EDITOR"} $ENV{"EDITOR"} $ENV{'VISUAL'}
Truth table50%2/4
A or B || C
A= $ENV{"CRITIQUE_EDITOR"}B= $ENV{"EDITOR"}C= $ENV{'VISUAL'}
ABCresult
1XX1
01X1
0011
0000
21  
22 # okay, we give you sensible Perl & Git defaults
23 16 $CONFIG{'IGNORE'} = {
24 '.git' => 1,
25 'blib' => 1,
26 'local' => 1,
27 '_build' => 1,
28 };
29  
30 # then we add in any of yours
31 16 ▶ if ( my $ignore = $ENV{'CRITIQUE_IGNORE'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $ignore = $ENV{"CRITIQUE_IGNORE"}) 0 16 16
32 $CONFIG{'IGNORE'}->{ $_ } = 1
33 0 foreach split /\:/ => $ignore;
34 }
35  
36 16 $ENV{'ANSI_COLORS_DISABLED'} = ! $CONFIG{'COLOR'};
37 }
38  
39 # ... then gloablly used stuff, ....
40  
41 16 our $JSON = JSON::XS->new->utf8->pretty->canonical;
42  
43 # ... then load the app and plugins
44  
45 16 use App::Cmd::Setup -app => {
46 plugins => [
47 'Prompt',
48 '=App::Critique::Plugin::UI',
49 ]
50 16 ▶};
Subroutine BEGIN: called CC=1 SCAR=0.0
51  
52 16 1;
53  
54 =pod
55  
56 =head1 NAME
57  
58 App::Critique - An incremental refactoring tool for Perl powered by Perl::Critic
59  
60 =head1 VERSION
61  
62 version 0.03
63  
64 =head1 DESCRIPTION
65  
66 This tool is specifically designed to find syntactic patterns in Perl source
67 code and allow you to review, refactor and commit your changes in one smooth
68 workflow.
69  
70 The idea behind L<App::Critique> is based on two assumptions.
71  
72 The first is that refactoring often involves a lot of repetitive and easily
73 automated actions, and this tool aims to make this workflow as smooth as
74 possible.
75  
76 The second is that many people, working on small incremental code improvements,
77 in individual easily revertable commits, can have a huge effect on a codebase,
78 which is exactly what this tool aims to do.
79  
80 The quickest way to start is to read the tutorial either by viewing the
81 documentation for L<App::Critique::Command::tutorial> or by installing the
82 app and running the following
83  
84 > critique tutorial
85  
86 =head1 AUTHOR
87  
88 Stevan Little <stevan@cpan.org>
89  
90 =head1 COPYRIGHT AND LICENSE
91  
92 This software is copyright (c) 2016 by Stevan Little.
93  
94 This is free software; you can redistribute it and/or modify it under
95 the same terms as the Perl 5 programming language system itself.
96  
97 =cut
98  
99 __END__
100  
101 # ABSTRACT: An incremental refactoring tool for Perl powered by Perl::Critic
102  
« Critique/Command.pm ↑ Summary Critique/Session/File.pm »