| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package App::Critique::Command::status; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 697 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 24 |  | 
| 4 | 1 |  |  | 1 |  | 3 | use warnings; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 40 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | our $VERSION   = '0.03'; | 
| 7 |  |  |  |  |  |  | our $AUTHORITY = 'cpan:STEVAN'; | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 1 |  |  | 1 |  | 3 | use Term::ANSIColor ':constants'; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 194 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 | 1 |  |  | 1 |  | 4 | use App::Critique::Session; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 17 |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 | 1 |  |  | 1 |  | 3 | use App::Critique -command; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | sub execute { | 
| 16 | 0 |  |  | 0 | 1 |  | my ($self, $opt, $args) = @_; | 
| 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 | 0 |  |  |  |  | $violations += $file->recall('violations') if defined $file->recall('violations'); | 
| 32 | 0 | 0 |  |  |  |  | $reviewed   += $file->recall('reviewed')   if defined $file->recall('reviewed'); | 
| 33 | 0 | 0 |  |  |  |  | $edited     += $file->recall('edited')     if defined $file->recall('edited'); | 
| 34 | 0 | 0 |  |  |  |  | $commited   += $file->recall('commited')   if defined $file->recall('commited'); | 
| 35 |  |  |  |  |  |  | } | 
| 36 |  |  |  |  |  |  |  | 
| 37 | 0 | 0 |  |  |  |  | if ( $opt->verbose ) { | 
| 38 | 0 |  |  |  |  |  | info(HR_DARK); | 
| 39 | 0 |  |  |  |  |  | info('CONFIG:'); | 
| 40 | 0 |  |  |  |  |  | info(HR_LIGHT); | 
| 41 | 0 |  | 0 |  |  |  | info('  perl_critic_profile : %s', $session->perl_critic_profile // 'auto'); | 
| 42 | 0 |  | 0 |  |  |  | info('  perl_critic_theme   : %s', $session->perl_critic_theme   // 'auto'); | 
| 43 | 0 |  | 0 |  |  |  | info('  perl_critic_policy  : %s', $session->perl_critic_policy  // 'auto'); | 
| 44 | 0 |  | 0 |  |  |  | info('  git_work_tree       : %s', $session->git_work_tree       // 'auto'); | 
| 45 | 0 |  | 0 |  |  |  | info('  git_branch          : %s', $session->git_branch          // 'auto'); | 
| 46 | 0 |  |  |  |  |  | info(HR_DARK); | 
| 47 | 0 |  |  |  |  |  | info('FILE CRITERIA:'); | 
| 48 | 0 |  |  |  |  |  | info(HR_LIGHT); | 
| 49 | 0 |  | 0 |  |  |  | info('  filter       : %s', $session->file_criteria->{'filter'}       // '-'); | 
| 50 | 0 |  | 0 |  |  |  | info('  match        : %s', $session->file_criteria->{'match'}        // '-'); | 
| 51 | 0 |  | 0 |  |  |  | info('  no-violation : %s', $session->file_criteria->{'no_violation'} // '-'); | 
| 52 |  |  |  |  |  |  | } | 
| 53 |  |  |  |  |  |  |  | 
| 54 | 0 |  |  |  |  |  | info(HR_DARK); | 
| 55 | 0 |  |  |  |  |  | info('FILES: <legend: [v|r|e|c] path>'); | 
| 56 | 0 | 0 |  |  |  |  | if ( $opt->verbose ) { | 
| 57 | 0 |  |  |  |  |  | info(HR_LIGHT); | 
| 58 | 0 |  |  |  |  |  | info('CURRENT FILE INDEX: (%d)', $curr_file_idx); | 
| 59 |  |  |  |  |  |  | } | 
| 60 | 0 |  |  |  |  |  | info(HR_LIGHT); | 
| 61 | 0 | 0 |  |  |  |  | if ( $num_files ) { | 
| 62 | 0 |  |  |  |  |  | foreach my $i ( 0 .. $#tracked_files ) { | 
| 63 | 0 |  |  |  |  |  | my $file = $tracked_files[$i]; | 
| 64 | 0 | 0 | 0 |  |  |  | info('%s [%s|%s|%s|%s] %s', | 
|  |  |  | 0 |  |  |  |  | 
|  |  |  | 0 |  |  |  |  | 
|  |  |  | 0 |  |  |  |  | 
| 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 | 0 |  |  |  |  | if ( $opt->verbose ) { | 
| 73 | 0 | 0 |  |  |  |  | foreach my $sha ( @{ $file->recall('shas') || [] } ) { | 
|  | 0 |  |  |  |  |  |  | 
| 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 | 0 |  |  |  |  | if ( $opt->verbose ) { | 
| 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; | 
| 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 |  |  |  |  |  |  |  |