Critique/Command/tutorial.pm untested

filter: Statementstmt 0.0% 0 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 24 CC 1 SCAR 6.9
CC
1
Cov
0%
opt_spec
2.0
validate_args
2.0
execute
2.0
CRAP 2.0
1 package App::Critique::Command::tutorial;
2  
3 use strict;
4 use warnings;
5  
6 our $VERSION = '0.03';
7 our $AUTHORITY = 'cpan:STEVAN';
8  
9 use App::Critique -command;
10  
11 sub opt_spec { return ([]) }
12 sub validate_args { 1 }
13 sub execute { info( $_[0]->description ) }
14  
15 1;
16  
17 =pod
18  
19 =head1 NAME
20  
21 App::Critique::Command::tutorial - Tutorial about how to use critique
22  
23 =head1 VERSION
24  
25 version 0.03
26  
27 =head1 DESCRIPTION
28  
29 Here is a short description of one my workflows. One thing to note is
30 that there is a pretty extensive help system here, so anytime you need
31 more info you can just do F<critique help> or F<critique help $command_name>
32 and get more info.
33  
34 =head2 Setup
35  
36 The very first thing you need to do is navigate to a git checkout
37 directory. Just like F<git> itself, F<critique> needs a working
38 directory to do its work in.
39  
40 =head2 Initialize
41  
42 Next you need to initialise a F<critique> session, I have found that
43 focusing on a single L<Perl::Critic> policy at a time can be helpful
44 and so I use the line below to initialize my session.
45  
46 > critique init -v --perl-critic-policy Variables::ProhibitUnusedVariables
47  
48 You will likely want to include the C<-v> (verbose) flag at a minimum,
49 but there is also a C<-d> (debug) flag which can be helpful.
50  
51 =head2 Collect
52  
53 Next you want to ask F<critique> to find all the files you want to
54 process. This will basically just traverse the directory tree and
55 find all the available perl files, and looks like this:
56  
57 > critique collect -v --root lib/ExampleCompany/
58  
59 You can also provide different criteria to help create the file list
60 that you want. You can do this in a few ways, here are some examples.
61  
62 > critique collect -v --root lib/ --filter ExampleCompany/Db/
63  
64 This would traverse the F<lib/> directory, but exclude any paths
65 which match the C<--filter> passed.
66  
67 > critique collect -v --root lib/ --match /Db/
68  
69 You can also specify what to include using the C<--match> argument,
70 the above will traverse F<lib/> but only match files which have
71 a F</Db/> folder in their path.
72  
73 > critique collect -v --root lib/ --no-violation
74  
75 You can also tell F<critique> to only collect files which have a
76 L<Perl::Critic> violation in them.
77  
78 Lastly, it is possible to combine these three arguments (C<--filter>,
79 C<--match> and C<--no-violation>) in any way you choose.
80  
81 Note that this is a destructive command, it will overwrite any
82 previous files and file associated settings. It is possible however
83 to use C<--dry-run> flag to specify a non-destructuve test run.
84  
85 =head2 Status
86  
87 So at this point it is good to know about the C<status> command. The
88 simplest version will just display information about the files that
89 have been collected and your current status in the F<critique> session.
90  
91 > critique status
92  
93 There is also additonal information available in (C<-v>) verbose mode
94 including the associated C<git> commit shas for each file and the
95 F<critique> session configuration information. Sometimes this is a lot
96 of information, so I recommend running it through a pager program like
97 C<more> or C<less>.
98  
99 > critique status -v | more
100  
101 It is useful to run this command regularly and take a look at the status
102 of your work.
103  
104 =head2 Process
105  
106 So, now onto the actual processing of files, the C<process> command will
107 do this one file at a time in a loop. If at any point you want to stop
108 processing it is possible to just press C<Cntl-C> to halt and F<critique>
109 will make every effort to save state.
110  
111 > critique process -v
112  
113 This is the only interactive command in this tool and I suggest you
114 use it a few times and read the output carefully. No tutorial I could
115 write will replace just using it a little.
116  
117 As mentioned above, a simple C<Cntl-C> will exit the current processing
118 loop. When you resume, you can either pick up where F<critique> thinks
119 you left off, or you can use the C<--back> or C<--next> arguments to
120 move backwards and forwards through history. Additionaly you can use the
121 C<--reset> flag to start from the very beginning of the list again.
122  
123 Lastly, keep in mind that this tool is non-destructive, meaning that it
124 if things don't work correctly, it is as simple as just pressing C<Cntl-C>
125 and repairing your C<git> checkout manually.
126  
127 =head1 AUTHOR
128  
129 Stevan Little <stevan@cpan.org>
130  
131 =head1 COPYRIGHT AND LICENSE
132  
133 This software is copyright (c) 2016 by Stevan Little.
134  
135 This is free software; you can redistribute it and/or modify it under
136 the same terms as the Perl 5 programming language system itself.
137  
138 =cut
139  
140 __END__
141  
142 # ABSTRACT: Tutorial about how to use critique
143