Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

elliot (8136)

elliot
  (email not shown publicly)
http://galumph.com/
AOL IM: elliotshank (Add Buddy, Send Message)

Journal of elliot (8136)

Sunday March 23, 2008
11:32 AM

The single most useful perlcritic command-line option.

[ #35963 ]
For me, it's --single-policy.

Generally, Perl::Critic is being used indirectly via a test using Test::P::C or Test::P::C::Progressive, with a perlcriticrc file that is in the distribution's t/ directory.

The most common reason I have for running perlcritic is when there's a Test::P::C::Progressive failure. In that case, I'm looking for violations of an individual policy to fix to get the violation count down.

--single-policy overrides all other selection criteria for policies. Its value, like the ones for the --include and --exclude options, is used as a regex applied against policy names with the /i, /m, and /x options applied to it. So, for example, if I want to scan for violations of Modules::RequireNoMatchVarsWithUseEnglish in the current directory, I can simply say

perlcritic --single-policy english .

When cleaning up a body of code, I find it easier to fix one kind of problem at a time in a bunch of files, rather than fixing all kinds of problems a single file at a time.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.