| 1 | package App::Critique::Command::status; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | our $VERSION = '0.03'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | our $AUTHORITY = 'cpan:STEVAN'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Term::ANSIColor ':constants'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use App::Critique::Session; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use App::Critique -command; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | sub execute { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | my ($self, $opt, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute: not called CC=27 SCAR=66.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | local $Term::ANSIColor::AUTORESET = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | my $session = $self->cautiously_load_session( $opt, $args ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | info('Session file loaded.'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | my @tracked_files = $session->tracked_files; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | my $num_files = scalar @tracked_files; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | my $curr_file_idx = $session->current_file_idx; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | my $git = $session->git_wrapper; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | my ($violations, $reviewed, $edited, $commited) = (0, 0, 0, 0); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | foreach my $file ( @tracked_files ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | $violations += $file->recall('violations') if defined $file->recall('violations'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | $reviewed += $file->recall('reviewed') if defined $file->recall('reviewed'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | $edited += $file->recall('edited') if defined $file->recall('edited'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | $commited += $file->recall('commited') if defined $file->recall('commited'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | if ( $opt->verbose ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | info(HR_DARK); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | info('CONFIG:'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | info(HR_LIGHT); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | info(' perl_critic_profile : %s', $session->perl_critic_profile // 'auto'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$session->perl_critic_profile // "auto"
MC/DC0%0/1
$session->perl_critic_profile // "auto"
$session->perl_critic_profile
Truth table0%0/2
A
A= $session->perl_critic_profile
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | info(' perl_critic_theme : %s', $session->perl_critic_theme // 'auto'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$session->perl_critic_theme // "auto"
MC/DC0%0/1
$session->perl_critic_theme // "auto"
$session->perl_critic_theme
Truth table0%0/2
A
A= $session->perl_critic_theme
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | info(' perl_critic_policy : %s', $session->perl_critic_policy // 'auto'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$session->perl_critic_policy // "auto"
MC/DC0%0/1
$session->perl_critic_policy // "auto"
$session->perl_critic_policy
Truth table0%0/2
A
A= $session->perl_critic_policy
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | info(' git_work_tree : %s', $session->git_work_tree // 'auto'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$session->git_work_tree // "auto"
MC/DC0%0/1
$session->git_work_tree // "auto"
$session->git_work_tree
Truth table0%0/2
A
A= $session->git_work_tree
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | info(' git_branch : %s', $session->git_branch // 'auto'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$session->git_branch // "auto"
MC/DC0%0/1
$session->git_branch // "auto"
$session->git_branch
Truth table0%0/2
A
A= $session->git_branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | info(HR_DARK); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | info('FILE CRITERIA:'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | info(HR_LIGHT); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | info(' filter : %s', $session->file_criteria->{'filter'} // '-'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$session->file_criteria->{"filter"} // "-"
MC/DC0%0/1
$session->file_criteria->{"filter"} // "-"
$session->file_criteria->{"filter"}
Truth table0%0/2
A
A= $session->file_criteria->{"filter"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | info(' match : %s', $session->file_criteria->{'match'} // '-'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$session->file_criteria->{"match"} // "-"
MC/DC0%0/1
$session->file_criteria->{"match"} // "-"
$session->file_criteria->{"match"}
Truth table0%0/2
A
A= $session->file_criteria->{"match"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | info(' no-violation : %s', $session->file_criteria->{'no_violation'} // '-'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$session->file_criteria->{"no_violation"} // "-"
MC/DC0%0/1
$session->file_criteria->{"no_violation"} // "-"
$session->file_criteria->{"no_violation"}
Truth table0%0/2
A
A= $session->file_criteria->{"no_violation"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | info(HR_DARK); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | info('FILES: <legend: [v|r|e|c] path>'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | if ( $opt->verbose ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | info(HR_LIGHT); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | info('CURRENT FILE INDEX: (%d)', $curr_file_idx); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | info(HR_LIGHT); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | if ( $num_files ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | foreach my $i ( 0 .. $#tracked_files ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | my $file = $tracked_files[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | info('%s [%s|%s|%s|%s] %s', | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/8
$file->recall("violations") // "-"
$file->recall("reviewed") // "-"
$file->recall("edited") // "-"
$file->recall("commited") // "-"
MC/DC0%0/1
$file->recall("violations") // "-"
$file->recall("violations")
MC/DC0%0/1
$file->recall("reviewed") // "-"
$file->recall("reviewed")
MC/DC0%0/1
$file->recall("edited") // "-"
$file->recall("edited")
MC/DC0%0/1
$file->recall("commited") // "-"
$file->recall("commited")
Truth table0%0/2
A
A= $file->recall("violations")
Truth table0%0/2
A
A= $file->recall("reviewed")
Truth table0%0/2
A
A= $file->recall("edited")
Truth table0%0/2
A
A= $file->recall("commited")
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | ($i == $curr_file_idx ? '>' : ' '), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | $file->recall('violations') // '-', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | $file->recall('reviewed') // '-', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | $file->recall('edited') // '-', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | $file->recall('commited') // '-', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | $file->relative_path( $session->git_work_tree ), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | if ( $opt->verbose ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | foreach my $sha ( @{ $file->recall('shas') || [] } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | info(' : %s', $git->show($sha, { format => '%h - %s', s => 1 })); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | info(ITALIC('... no files added.')); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | info(HR_DARK); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | info('TOTAL: %s file(s)', format_number($num_files) ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | info(' (v)iolations : %s', format_number($violations)); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | info(' (r)eviwed : %s', format_number($reviewed) ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | info(' (e)dited : %s', format_number($edited) ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | info(' (c)ommited : %s', format_number($commited) ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | if ( $opt->verbose ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | info(HR_LIGHT); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | info('PATH: (%s)', $session->session_file_path); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | info(HR_DARK); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | App::Critique::Command::status - Display status of the current critique session. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | version 0.03 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | This command will display information about the current critique session. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | Among other things, this will include information about each of the files, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | such as how many violations were found, how many of those violations were | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | reviewed, and how many were edited. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | Stevan Little <stevan@cpan.org> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | This software is copyright (c) 2016 by Stevan Little. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | # ABSTRACT: Display status of the current critique session. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||