#######################################################################
# $URL: http://perlcritic.tigris.org/svn/perlcritic/tags/Perl-Critic-0.18/TODO.pod $
# $Date: 2006-07-16 22:15:05 -0700 (Sun, 16 Jul 2006) $
# $Author: thaljef $
# $Revision: 506 $
#######################################################################
NEW FEATURES
Report safari sections instead of book page numbers.
BUGS/LIMITATIONS
Errors in .perlcriticrc are silent
Modules::RequireVersionVar
Doesn't enforce three-part versions
NamingConventions::ProhibitAmbiguousNames
Don't allow compound names with forbidden words, like "last_record". Allow forbidden words in RHS of variable declarations
Subroutines::ProtectPrivateSubs
Doesn't forbid
$pkg->_foo()
because it can't tell the difference between that and$self->_foo()
OTHER PBP POLICIES THAT SEEM FEASIBLE TO IMPLEMENT
ValuesAndExpressions::ProhibitCommaSeparatedStatements (p68)
ValuesAndExpressions::RequireListParens (p71)
ValuesAndExpressions::ProhibitScalarGrep (p71)
Look for grep in a scalar context and recommend any() instead
Variables::RequireLocalizedPunctuationVars (p81)
Variables::RequireNegativeIndices (p88)
Variables::RequireLexicalForLoopIterator (p108)
Variables::ProhibitTopicChangeInListFunction (p114)
Documentation::PodSpelling (p148)
Base it on Pod::Spell or Test::Spelling. Add a "=for stopwords" section for words to skip, as per Pod::Spell.
BuiltinFunctions::ProhibitReverseSortBlock (p152)
Don't allow first instance of
$b
to be before first instance of$a
.Subroutines::RequireArgUnpacking (p178)
Ensure that the first child of a sub is PPI::Statement::Variable
Subroutines::ProhibitManyArgs (p182)
If first PPI::Statement::Variable is a list
my
, make sure it's fewer than N elements. Otherwise make sure there are less than N PPI::Statement::Variables in a row at beginInputOutput::RequireErrorChecking (p208)
Forbid open, print, close in void context
InputOutput::RequireBriefOpen (p209)
Make sure there's a close within N statements of an open, both with same lexical FH
InputOutput::ProhibitJoinedReadline (p213)
InputOutput::ProhibitExplicitStdin (p216)
InputOutput::ProhibitInteractiveTest (p218)
Forbid -t operand
Miscellanea::ProhibitObnoxiousComments
Forbid excessive hash marks e.g. "#### This is a loud comment ####". Make the obnoxious pattern configurable
RegularExpressions::RequireBracesForMultiline (p242)
RegularExpressions::ProhibitUnusualDelimiters (p246)
RegularExpressions::ProhibitEscapedMetacharacters (p247)
RegularExpressions::ProhibitEnumeratedClasses (p248)
This will be avoided for ASCII-only code
RegularExpressions::ProhibitUnusedCapture (p252)
Look for LHS of regexp or use of
$1
,$2
, ... before next regexpRegularExpressions::ProhibitCaptureWithoutTest (p253)
$1
,$2
, ... must be inside conditional with no preceding regexpRegularExpressions::ProhibitComplexRegexps (p261)
If regexp is longer than N characters/lines, require it be split into
qr//
pieces.RegularExpressions::ProhibitSingleCharAlternation (p265)
Not sure if this is easy or hard. Need to look at what PPI emits for regexps.
RegularExpressions::ProhibitFixedStringMatches (p271)
Can't be
qr/\s*\\A\s*\((?:\?:)?(?:\s*\w+\s*\|)*\s*\w+\s*\)\s*\\z/
orqr/\s*\\A\s*\w+\s*\\z/
TestingAndDebugging::ProhibitProlongedStrictureOverride (p443)
NON-PBP POLICIES WANTED
BuiltInFunctions::RequireConstantSprintfFormat
BuiltInFunctions::RequireConstantUnpackFormat
http://home.earthlink.net/~josh.jore/new-warnings/slides/slide1.html
ControlStructures::ProhibitIncludeViaDo
Forbid
do "foo.pl"
. Not sure about this policy name.CodingStyle::ProhibitNonASCII
Definitely low severity! Only looks at code, not comments or POD
Miscellanea::RequireMinimumPerlVersion
Every module should have something like
use 5.6.0
Miscellanea::Prohibit5006isms
Keep the code 5.005 compatible Low severity
Variables::ProhibitUseVars
Require
our $foo
instead. This contradicts Miscellanea::Prohibit5006isms. Maybe verifyuse 5.6
before applying this policy. Low severity.VariablesAndExpressions::ProhibitQuotedHashKeys
Forbid quotes around hash keys, unless they are really needed. This is against what Damian says. Suggested by Adam Kennedy. Low severity.
Miscellanea::B::Lint
Create a compatibility layer for the B::Lint code analyzer. Make it very clear that this runs code and thus is a security hole.
CodingStyle::ProhibitFunctionalNew
Good:
Foo::Bar->new
, Bad:new Foo::Bar
VariablesAndExpressions::RequireConstantVersion (low severity)
VariablesAndExpressions::ProhibitComplexVersion (medium severity) http://rt.cpan.org/Ticket/Display.html?id=20439
BuiltinFunctions::ProhibitStringSplit
Since
split("x", $whatever)
is translated tosplit(/x/, $whatever)
, you might as well write it that way anyway. It will help people remember. I don't know how many times I've seen someone perplexed bysplit("|", $something)
not working.However, there is at least one exception, and if you write such a rule, you should take this special case into account:
$ perl -le 'print map {"<$_>"} split q{ }, " Romeo and Juliet "' <Romeo><and><Juliet> $ perl -le 'print map {"<$_>"} split / /, " Romeo and Juliet "' <><Romeo><and><Juliet>
Quoting from http://perldoc.perl.org/functions/split.html
As a special case, specifying a PATTERN of space (' ') will split on white space just as split with no arguments does. Thus, split(' ') can be used to emulate awk's default behavior, whereas split(/ /) will give you as many null initial fields as there are leading spaces.
REFACTORINGS and ENHANCEMENTS
Move %FORMATS from `perlcritic` into Perl::Critic::Utils
So that Test::P::C can use them. Use a subroutine instead of a package var.
Alias -verbose to -format option in Test::P::C.
Give it same functionality as the -verbose option in `perlcritic`
Enhance P::C::critique() to accept file names, directories, or code strings (as refs)
Just like `perlcritic` does now.