Login
Here's a pseudocode summary of my tremendous yak shaving evening,
[gknop/Perl-Critic.git] / TODO.pod
CommitLineData
501ee198
JRT
1=pod
2
3=for stopwords LHS RHS REFACTORINGS FH stopwords
4
daad783f
AL
5=head1
6
7 #######################################################################
8 # $URL$
9 # $Date$
10 # $Author$
11 # $Revision$
12 #######################################################################
13
14=head1 NEW FEATURES
15
16=over 4
17
18=item * Report safari sections instead of book page numbers.
19
20=back
21
22=head1 BUGS/LIMITATIONS
23
24=over 4
25
26=item * Errors in .perlcriticrc are silent
27
28=item * Modules::RequireVersionVar
29
30Doesn't enforce three-part versions
31
32=item * NamingConventions::ProhibitAmbiguousNames
33
34Don't allow compound names with forbidden words, like "last_record".
35Allow forbidden words in RHS of variable declarations
36
37=item * Subroutines::ProtectPrivateSubs
38
39Doesn't forbid C<< $pkg->_foo() >> because it can't tell the
40difference between that and C<< $self->_foo() >>
41
365e3d9d
AL
42=back
43
daad783f
AL
44=head1 OTHER PBP POLICIES THAT SEEM FEASIBLE TO IMPLEMENT
45
365e3d9d
AL
46=over 4
47
daad783f
AL
48=item * ValuesAndExpressions::ProhibitCommaSeparatedStatements (p68)
49
50=item * ValuesAndExpressions::RequireListParens (p71)
51
52=item * ValuesAndExpressions::ProhibitScalarGrep (p71)
53
54Look for grep in a scalar context and recommend any() instead
55
56=item * Variables::RequireLocalizedPunctuationVars (p81)
57
58=item * Variables::RequireNegativeIndices (p88)
59
60=item * Variables::RequireLexicalForLoopIterator (p108)
61
62=item * Variables::ProhibitTopicChangeInListFunction (p114)
63
64=item * Documentation::PodSpelling (p148)
65
66Base it on Pod::Spell or Test::Spelling. Add a "=for stopwords"
67section for words to skip, as per Pod::Spell.
68
69=item * BuiltinFunctions::ProhibitReverseSortBlock (p152)
70
71Don't allow first instance of C<$b> to be before first instance of C<$a>.
72
73=item * Subroutines::RequireArgUnpacking (p178)
74
75Ensure that the first child of a sub is PPI::Statement::Variable
76
77=item * Subroutines::ProhibitManyArgs (p182)
78
79If first L<PPI::Statement::Variable> is a list C<my>, make sure
80it's fewer than N elements. Otherwise make sure there are less
81than N L<PPI::Statement::Variable>s in a row at begin
82
83=item * InputOutput::RequireErrorChecking (p208)
84
85Forbid open, print, close in void context
86
87=item * InputOutput::RequireBriefOpen (p209)
88
89Make sure there's a close within N statements of an open, both with
90same lexical FH
91
92=item * InputOutput::ProhibitJoinedReadline (p213)
93
94=item * InputOutput::ProhibitExplicitStdin (p216)
95
96=item * InputOutput::ProhibitInteractiveTest (p218)
97
98Forbid -t operand
99
100=item * Miscellanea::ProhibitObnoxiousComments
101
102Forbid excessive hash marks e.g. "#### This is a loud comment ####".
103Make the obnoxious pattern configurable
104
105=item * RegularExpressions::RequireBracesForMultiline (p242)
106
107=item * RegularExpressions::ProhibitUnusualDelimiters (p246)
108
109=item * RegularExpressions::ProhibitEscapedMetacharacters (p247)
110
111=item * RegularExpressions::ProhibitEnumeratedClasses (p248)
112
113This will be avoided for ASCII-only code
114
115=item * RegularExpressions::ProhibitUnusedCapture (p252)
116
117Look for LHS of regexp or use of C<$1>, C<$2>, ... before next
118regexp
119
120=item * RegularExpressions::ProhibitCaptureWithoutTest (p253)
121
122C<$1>, C<$2>, ... must be inside conditional with no preceding regexp
123
124=item * RegularExpressions::ProhibitComplexRegexps (p261)
125
126If regexp is longer than N characters/lines, require it be split
127into C<qr//> pieces.
128
129=item * RegularExpressions::ProhibitSingleCharAlternation (p265)
130
131Not sure if this is easy or hard. Need to look at what PPI emits
132for regexps.
133
134=item * RegularExpressions::ProhibitFixedStringMatches (p271)
135
136Can't be C<qr/\s*\\A\s*\((?:\?:)?(?:\s*\w+\s*\|)*\s*\w+\s*\)\s*\\z/>
137or C<qr/\s*\\A\s*\w+\s*\\z/>
138
139=item * TestingAndDebugging::ProhibitProlongedStrictureOverride (p443)
140
141=back
142
143=head1 NON-PBP POLICIES WANTED
144
145=over 4
146
147=item * BuiltInFunctions::RequireConstantSprintfFormat
148
149=item * BuiltInFunctions::RequireConstantUnpackFormat
150
151L<http://home.earthlink.net/~josh.jore/new-warnings/slides/slide1.html>
152
153=item * ControlStructures::ProhibitIncludeViaDo
154
155Forbid C<do "foo.pl">. Not sure about this policy name.
156
157=item * CodingStyle::ProhibitNonASCII
158
159Definitely low severity! Only looks at code, not comments or POD
160
161=item * Miscellanea::RequireMinimumPerlVersion
162
163Every module should have something like C<use 5.6.0>
164
165=item * Miscellanea::Prohibit5006isms
166
167Keep the code 5.005 compatible Low severity
168
169=item * Variables::ProhibitUseVars
170
171Require C<our $foo> instead. This contradicts
172Miscellanea::Prohibit5006isms. Maybe verify C<use 5.6> before
173applying this policy. Low severity.
174
175=item * VariablesAndExpressions::ProhibitQuotedHashKeys
176
177Forbid quotes around hash keys, unless they are really needed. This
178is against what Damian says. Suggested by Adam Kennedy. Low
179severity.
180
181=item * Miscellanea::B::Lint
182
183Create a compatibility layer for the L<B::Lint> code analyzer. Make
184it very clear that this runs code and thus is a security hole.
185
186=item * CodingStyle::ProhibitFunctionalNew
187
188Good: C<< Foo::Bar->new >>, Bad: C<< new Foo::Bar >>
189
190=item * VariablesAndExpressions::RequireConstantVersion (low severity)
191
192VariablesAndExpressions::ProhibitComplexVersion (medium severity)
193L<http://rt.cpan.org/Ticket/Display.html?id=20439>
194
501ee198 195=item * BuiltinFunctions::ProhibitStringSplit
daad783f
AL
196
197Since C<split("x", $whatever)> is translated to C<split(/x/, $whatever)>,
198you might as well write it that way anyway. It will help people
199remember. I don't know how many times I've seen someone perplexed
200by C<split("|", $something)> not working.
201
202However, there is at least one exception, and if you write such a
203rule, you should take this special case into account:
204
205 $ perl -le 'print map {"<$_>"} split q{ }, " Romeo and Juliet "'
206 <Romeo><and><Juliet>
207 $ perl -le 'print map {"<$_>"} split / /, " Romeo and Juliet "'
208 <><Romeo><and><Juliet>
209
210Quoting from L<http://perldoc.perl.org/functions/split.html>
211
212 As a special case, specifying a PATTERN of space (' ') will split
213 on white space just as split with no arguments does. Thus,
214 split(' ') can be used to emulate awk's default behavior, whereas
215 split(/ /) will give you as many null initial fields as there
216 are leading spaces.
217
218See also L<http://www.perlmonks.org/?node_id=287545>
219
220=back
221
222=head1 REFACTORINGS and ENHANCEMENTS
223
224=over 4
225
501ee198 226=item * Move %FORMATS from `perlcritic` into Perl::Critic::Utils
daad783f 227
501ee198 228So that Test::P::C can use them. Use a subroutine instead of a package var.
daad783f
AL
229
230=item * Alias -verbose to -format option in Test::P::C.
231
232Give it same functionality as the -verbose option in `perlcritic`
233
501ee198
JRT
234=item * Enhance P::C::critique() to accept file names, directories, or code strings (as refs)
235
236Just like `perlcritic` does now.
daad783f 237
85e38a07
AL
238=item * Helper functions:
239
240Combine these three:
241
242 return if is_hash_key($elem);
243 return if is_method_call($elem);
244 return if is_subroutine_name($elem);
245
daad783f 246=back
501ee198 247
85e38a07 248=cut