Login
Plan ahead for when a PPI that supports literal() is released to CPAN
[gknop/Perl-Critic.git] / TODO.pod
CommitLineData
9b8f64cf
CD
1# best viewed via "perldoc TODO.pod"
2
501ee198
JRT
3=pod
4
a73f4a71 5=for stopwords LHS RHS REFACTORINGS FH SVN stopwords
501ee198 6
dae851e8
JRT
7=head1 NAME
8
f7231315 9TODO - Things for Perl::Critic developers to do
dae851e8
JRT
10
11=head1 SOURCE
daad783f
AL
12
13 #######################################################################
14 # $URL$
15 # $Date$
16 # $Author$
17 # $Revision$
18 #######################################################################
19
20=head1 NEW FEATURES
21
22=over 4
23
8b5892fc 24=item * Report Safari sections in addition to book page numbers.
9bc546d7 25
c6e7b236 26=item * Report some statistics on the violations and the source code.
d1d6429f 27
c6e7b236
JRT
28e.g. Number of violations of each policy/severity. Total lines of code,
29number of subroutines, average number of statements/operators per sub.
d1d6429f
AL
30
31=back
32
daad783f
AL
33=head1 BUGS/LIMITATIONS
34
35=over 4
36
37=item * Errors in .perlcriticrc are silent
38
39=item * Modules::RequireVersionVar
40
41Doesn't enforce three-part versions
42
43=item * NamingConventions::ProhibitAmbiguousNames
44
45Don't allow compound names with forbidden words, like "last_record".
46Allow forbidden words in RHS of variable declarations
47
48=item * Subroutines::ProtectPrivateSubs
49
50Doesn't forbid C<< $pkg->_foo() >> because it can't tell the
51difference between that and C<< $self->_foo() >>
52
d1d6429f
AL
53=item * ErrorHandling::RequireCarping
54
55This should not complain about using warn or die if it's not in a function.
56
5c77583a
AL
57Also, if the error string ends with a "\n", then the line number
58and package information is not shown, so it doesn't matter if you
59use carp/confess or not. For example:
60
61 my $fh;
62 if ( !open( $fh, '<', $filename ) ) {
63 warn "ack: $filename: $!\n";
64 return;
65 }
66
67I just want to print a warning and move on. The location is irrelevant.
68
365e3d9d
AL
69=back
70
daad783f
AL
71=head1 OTHER PBP POLICIES THAT SEEM FEASIBLE TO IMPLEMENT
72
365e3d9d
AL
73=over 4
74
daad783f
AL
75=item * ValuesAndExpressions::ProhibitCommaSeparatedStatements (p68)
76
77=item * ValuesAndExpressions::RequireListParens (p71)
78
79=item * ValuesAndExpressions::ProhibitScalarGrep (p71)
80
71cb5eb8
CD
81Look for grep in a scalar context and recommend any() instead.
82Perhaps we need to distinguish cases like:
83 $count += grep {qr/foo/} @list;
daad783f
AL
84
85=item * Variables::RequireLocalizedPunctuationVars (p81)
86
daad783f
AL
87=item * Variables::ProhibitTopicChangeInListFunction (p114)
88
89=item * Documentation::PodSpelling (p148)
90
91Base it on Pod::Spell or Test::Spelling. Add a "=for stopwords"
92section for words to skip, as per Pod::Spell.
93
daad783f
AL
94=item * Subroutines::RequireArgUnpacking (p178)
95
96Ensure that the first child of a sub is PPI::Statement::Variable
71cb5eb8 97(unless the sub has N or fewer statements, where N defaults to 1.
daad783f
AL
98
99=item * Subroutines::ProhibitManyArgs (p182)
100
71cb5eb8
CD
101If first L<PPI::Statement::Variable> is a list C<my>, and @_ is used,
102make sure it's fewer than N elements. Otherwise make sure there are
103less than N L<PPI::Statement::Variable>s in a row at begin which
104shift.
daad783f
AL
105
106=item * InputOutput::RequireErrorChecking (p208)
107
71cb5eb8
CD
108Forbid open, print, close in void context, unless "use Fatal" is in
109effect.
daad783f
AL
110
111=item * InputOutput::RequireBriefOpen (p209)
112
113Make sure there's a close within N statements of an open, both with
114same lexical FH
115
116=item * InputOutput::ProhibitJoinedReadline (p213)
117
118=item * InputOutput::ProhibitExplicitStdin (p216)
119
daad783f
AL
120=item * Miscellanea::ProhibitObnoxiousComments
121
122Forbid excessive hash marks e.g. "#### This is a loud comment ####".
123Make the obnoxious pattern configurable
124
125=item * RegularExpressions::RequireBracesForMultiline (p242)
126
127=item * RegularExpressions::ProhibitUnusualDelimiters (p246)
128
129=item * RegularExpressions::ProhibitEscapedMetacharacters (p247)
130
131=item * RegularExpressions::ProhibitEnumeratedClasses (p248)
132
133This will be avoided for ASCII-only code
134
135=item * RegularExpressions::ProhibitUnusedCapture (p252)
136
137Look for LHS of regexp or use of C<$1>, C<$2>, ... before next
138regexp
139
daad783f
AL
140=item * RegularExpressions::ProhibitComplexRegexps (p261)
141
142If regexp is longer than N characters/lines, require it be split
143into C<qr//> pieces.
144
145=item * RegularExpressions::ProhibitSingleCharAlternation (p265)
146
147Not sure if this is easy or hard. Need to look at what PPI emits
1fd10f9b 148for regexps. Make an exception for qr/ [ ] /x.
daad783f
AL
149
150=item * RegularExpressions::ProhibitFixedStringMatches (p271)
151
152Can't be C<qr/\s*\\A\s*\((?:\?:)?(?:\s*\w+\s*\|)*\s*\w+\s*\)\s*\\z/>
153or C<qr/\s*\\A\s*\w+\s*\\z/>
154
155=item * TestingAndDebugging::ProhibitProlongedStrictureOverride (p443)
156
71cb5eb8
CD
157This conflicts with TestingAndDebugging::ProhibitNoStrict
158
daad783f
AL
159=back
160
161=head1 NON-PBP POLICIES WANTED
162
163=over 4
164
165=item * BuiltInFunctions::RequireConstantSprintfFormat
166
167=item * BuiltInFunctions::RequireConstantUnpackFormat
168
169L<http://home.earthlink.net/~josh.jore/new-warnings/slides/slide1.html>
170
171=item * ControlStructures::ProhibitIncludeViaDo
172
173Forbid C<do "foo.pl">. Not sure about this policy name.
174
175=item * CodingStyle::ProhibitNonASCII
176
177Definitely low severity! Only looks at code, not comments or POD
178
79b72614
CD
179=item * CodingStyle::RequireUTF8
180
181All characters must be valid UTF-8. Note that typical ASCII Perl code
182is a valid UTF8 subset.
183
daad783f
AL
184=item * Miscellanea::RequireMinimumPerlVersion
185
186Every module should have something like C<use 5.6.0>
187
188=item * Miscellanea::Prohibit5006isms
189
190Keep the code 5.005 compatible Low severity
191
192=item * Variables::ProhibitUseVars
193
194Require C<our $foo> instead. This contradicts
195Miscellanea::Prohibit5006isms. Maybe verify C<use 5.6> before
196applying this policy. Low severity.
197
198=item * VariablesAndExpressions::ProhibitQuotedHashKeys
199
200Forbid quotes around hash keys, unless they are really needed. This
201is against what Damian says. Suggested by Adam Kennedy. Low
202severity.
203
204=item * Miscellanea::B::Lint
205
206Create a compatibility layer for the L<B::Lint> code analyzer. Make
207it very clear that this runs code and thus is a security hole.
208
209=item * CodingStyle::ProhibitFunctionalNew
210
211Good: C<< Foo::Bar->new >>, Bad: C<< new Foo::Bar >>
212
213=item * VariablesAndExpressions::RequireConstantVersion (low severity)
214
215VariablesAndExpressions::ProhibitComplexVersion (medium severity)
216L<http://rt.cpan.org/Ticket/Display.html?id=20439>
217
9b8f64cf
CD
218=item * Tests::RequireTestDescriptions
219
220If Test::More is detected:
221
222 ok $foo; # not ok
223 ok $foo, 'foo got populated'; # ok
224 is $foo, 'bar'; # not ok
225 is $foo, 'bar', 'foo value'; # ok
226
71cb5eb8
CD
227=item * ValuesAndExpressions::ProhibitUselessQuotingOfVariables
228
229I've seen a lot of beginners do things like this:
230
231 open( my $fh, "$filename" );
232
233There's no reason for C<$filename> to be quoted. (except stringifying
234overloaded instances)
235
c6e7b236
JRT
236=item * Variables::ProhibitPerl4PackageNames
237
238Forbid old-schoole package names like Foo'Bar'Baz. This should also
239apply to any variables or subroutines that get declared/called.
240
79b72614
CD
241=item * CodingStyle::RequireEditorSettings
242
243Files must have something like the following in them for Emacs and Vi:
244
245 # Local Variables:
246 # mode: cperl
247 # cperl-indent-level: 4
248 # fill-column: 100
249 # End:
250 # vim: expandtab shiftwidth=4:
251
252=item * Documentation::RequireSynopsis
253
254=item * Documentation::RequireLicense
255
256These are simplified versions of Documentation::RequirePodSections.
257
258=item * CodingStyle::RequireConsistentNewlines
259
260Mixing any two of \r\n, \r and \n in the same file causes problems
261with GnuPG (and thus Module::Signature). This applies to the whole
262file, including strings, heredocs, POD, __DATA__, etc.
263
264=item * Miscellaneous::ProhibitBoilerplate
265
266Complain about copy-and-paste code or docs from h2xs, Module::Starter,
267etc.
c6e7b236 268
daad783f
AL
269=back
270
271=head1 REFACTORINGS and ENHANCEMENTS
272
273=over 4
274
daad783f
AL
275=item * Alias -verbose to -format option in Test::P::C.
276
277Give it same functionality as the -verbose option in `perlcritic`
278
501ee198
JRT
279=item * Enhance P::C::critique() to accept file names, directories, or code strings (as refs)
280
9b8f64cf 281Just like F<bin/perlcritic> does now.
daad783f 282
9b8f64cf
CD
283=item * Add C<-cache> flag to F<bin/perlcritic>
284
285If enabled, this turns on L<PPI::Cache>:
286
287 require PPI::Cache;
288 my $cache_path = "/tmp/test-perl-critic-cache-$ENV{USER}";
289 mkdir $cache_path, oct 700 if (! -d $cache_path);
290 PPI::Cache->import(path => $cache_path);
291
292(see F<t/40_criticize.t> for a more robust implementation)
293
79b72614
CD
294=item * File::RequirePortableName
295
296No spaces, punctuation, etc.
297
9b8f64cf
CD
298=back
299
300=head1 PPI BUGS
301
302We're waiting on the following bugs to get fixed in a CPAN release of PPI:
303
304=over 4
305
daad783f 306=back
501ee198 307
85e38a07 308=cut