I took a first pass at a perlcritic test: t/codingstd/perlcritic.t ; this test isn't run by default.

It reports on only the following perlcritic rules at the moment:

    TestingAndDebugging::RequireUseStrict
    TestingAndDebugging::RequireUseWarnings
    Variables::ProhibitConditionalDeclarations
    InputOutput::ProhibitTwoArgOpen
    InputOutput::ProhibitBarewordFileHandles
    NamingConventions::ProhibitAmbiguousNames
    Subroutines::ProhibitBuiltinHomonyms
    Subroutines::ProhibitExplicitReturnUndef
    Subroutines::ProhibitSubroutinePrototypes
    Subroutines::RequireFinalReturn
    CodeLayout::ProhibitHardTabs

Which seem like a fairly sane, reasonable starting point. (At least to this crazy.) While Chip should probably bless this, it's probably a fairly safe CAGE item to run this test (you can run it with no args and get a LOT of output, or pass filenames to check as args.), and then patch up the files. Note that turning on warnings might mean you need to further clean some code.

Since a lot of this perl code this test checks doesn't have explicit tests, make sure no new failures are generated by your cleanup. As always, try to keep whitespace only fixes (removing hard tabs) as separate patches.

Finally, don't feel you have to make a file error-free. Pick one error that bugs you, grep through the test output for that, and fix those errors.

Here's an example:

$ perl t/codingstd/perlcritic.t languages/tcl/lib/Parrot/Test/Tcl.pm
1..1
not ok 1 - languages/tcl/lib/Parrot/Test/Tcl.pm
#     Failed test (t/codingstd/perlcritic.t at line 83)
# got: 'Code before strictures are enabled at line 16, column 1.
#
# Code before warnings are enabled at line 16, column 1.
#
# Hard tabs used at line 80, column 1.
# '
#     expected: ''
# Looks like you failed 1 test of 1.

So, in this case, you could pretty easily fix the hard tab issue, but turning on strict and warnings causes a bunch of other issues at runtime, so you'd then have to track those down.

Regards.

--
Will "Coke" Coleda
[EMAIL PROTECTED]


Reply via email to