File Coverage

blib/lib/App/Critique.pm
Criterion Covered Total %
statement 25 26 96.1
branch 1 2 50.0
condition 10 16 62.5
subroutine 6 6 100.0
pod n/a
total 42 50 84.0


line stmt bran cond sub pod time code
1             package App::Critique;
2              
3 3     3   147694 use strict;
  3         9  
  3         107  
4 3     3   18 use warnings;
  3         8  
  3         95  
5              
6 3     3   1514 use File::HomeDir ();
  3         16150  
  3         68  
7 3     3   1429 use JSON::MaybeXS ();
  3         23991  
  3         812  
8              
9             our $VERSION = '0.05';
10             our $AUTHORITY = 'cpan:STEVAN';
11              
12             # load our CONFIG first, ...
13              
14             our %CONFIG;
15             BEGIN {
16 3   33 3   46 $CONFIG{'HOME'} = $ENV{'CRITIQUE_HOME'} || File::HomeDir->my_home;
17 3   50     178 $CONFIG{'DATA_DIR'} = $ENV{'CRITIQUE_DATA_DIR'} || '.critique';
18 3   50     28 $CONFIG{'DATA_FILE'} = $ENV{'CRITIQUE_DATA_FILE'} || 'session.json';
19 3   100     26 $CONFIG{'COLOR'} = $ENV{'CRITIQUE_COLOR'} // 1;
20 3   100     18 $CONFIG{'DEBUG'} = $ENV{'CRITIQUE_DEBUG'} // 0;
21 3   100     23 $CONFIG{'VERBOSE'} = $ENV{'CRITIQUE_VERBOSE'} // 0;
22 3   33     26 $CONFIG{'EDITOR'} = $ENV{'CRITIQUE_EDITOR'} || $ENV{'EDITOR'} || $ENV{'VISUAL'};
23              
24             # okay, we give you sensible Perl & Git defaults
25 3         19 $CONFIG{'IGNORE'} = {
26             '.git' => 1,
27             'blib' => 1,
28             'local' => 1,
29             '_build' => 1,
30             };
31              
32             # then we add in any of yours
33 3 50       17 if ( my $ignore = $ENV{'CRITIQUE_IGNORE'} ) {
34             $CONFIG{'IGNORE'}->{ $_ } = 1
35 0         0 foreach split /\:/ => $ignore;
36             }
37              
38 3         238 $ENV{'ANSI_COLORS_DISABLED'} = ! $CONFIG{'COLOR'};
39             }
40              
41             # ... then gloablly used stuff, ....
42              
43             our $JSON = JSON::MaybeXS->new->utf8->pretty->canonical;
44              
45             # ... then load the app and plugins
46              
47 3         42 use App::Cmd::Setup -app => {
48             plugins => [
49             'Prompt',
50             '=App::Critique::Plugin::UI',
51             ]
52 3     3   1798 };
  3         125995  
53              
54             1;
55              
56             =pod
57              
58             =head1 NAME
59              
60             App::Critique - An incremental refactoring tool for Perl powered by Perl::Critic
61              
62             =head1 VERSION
63              
64             version 0.05
65              
66             =head1 DESCRIPTION
67              
68             This tool is specifically designed to find syntactic patterns in Perl source
69             code and allow you to review, refactor and commit your changes in one smooth
70             workflow.
71              
72             The idea behind L<App::Critique> is based on two assumptions.
73              
74             The first is that refactoring often involves a lot of repetitive and easily
75             automated actions, and this tool aims to make this workflow as smooth as
76             possible.
77              
78             The second is that many people, working on small incremental code improvements,
79             in individual easily revertable commits, can have a huge effect on a codebase,
80             which is exactly what this tool aims to do.
81              
82             The quickest way to start is to read the tutorial either by viewing the
83             documentation for L<App::Critique::Command::tutorial> or by installing the
84             app and running the following
85              
86             > critique tutorial
87              
88             =head1 AUTHOR
89              
90             Stevan Little <stevan@cpan.org>
91              
92             =head1 COPYRIGHT AND LICENSE
93              
94             This software is copyright (c) 2016 by Stevan Little.
95              
96             This is free software; you can redistribute it and/or modify it under
97             the same terms as the Perl 5 programming language system itself.
98              
99             =cut
100              
101             __END__
102              
103             # ABSTRACT: An incremental refactoring tool for Perl powered by Perl::Critic
104