| 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
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
| |||||||||||||||||||||||||||||||||||
| 17 | 16 | ▶ | $CONFIG{'COLOR'} = $ENV{'CRITIQUE_COLOR'} // 1; | ||||||||||||||||||||||||||||||||
|
Condition100%2/2
$ENV{"CRITIQUE_COLOR"} // 1
MC/DC100%1/1
$ENV{"CRITIQUE_COLOR"} // 1
$ENV{"CRITIQUE_COLOR"}
Truth table100%2/2
A
A= $ENV{"CRITIQUE_COLOR"}
| |||||||||||||||||||||||||||||||||||
| 18 | 16 | ▶ | $CONFIG{'DEBUG'} = $ENV{'CRITIQUE_DEBUG'} // 0; | ||||||||||||||||||||||||||||||||
|
Condition100%2/2
$ENV{"CRITIQUE_DEBUG"} // 0
MC/DC100%1/1
$ENV{"CRITIQUE_DEBUG"} // 0
$ENV{"CRITIQUE_DEBUG"}
Truth table100%2/2
A
A= $ENV{"CRITIQUE_DEBUG"}
| |||||||||||||||||||||||||||||||||||
| 19 | 16 | ▶ | $CONFIG{'VERBOSE'} = $ENV{'CRITIQUE_VERBOSE'} // 0; | ||||||||||||||||||||||||||||||||
|
Condition100%2/2
$ENV{"CRITIQUE_VERBOSE"} // 0
MC/DC100%1/1
$ENV{"CRITIQUE_VERBOSE"} // 0
$ENV{"CRITIQUE_VERBOSE"}
Truth table100%2/2
A
A= $ENV{"CRITIQUE_VERBOSE"}
| |||||||||||||||||||||||||||||||||||
| 20 | 16 | ▶ | $CONFIG{'EDITOR'} = $ENV{'CRITIQUE_EDITOR'} || $ENV{'EDITOR'} || $ENV{'VISUAL'}; | ||||||||||||||||||||||||||||||||
|
Condition66%4/6
$ENV{'CRITIQUE_EDITOR'} || $ENV{'EDITOR'} || $ENV{'VISUAL'}
$ENV{"CRITIQUE_EDITOR"} or $ENV{"EDITOR"}
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'}
| |||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||||||||||||||