kalyanrajsista has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to use Perl::Critic module as part of my code review to check if there are any violations in the coding standards
use strict; use Perl::Critic qw(critique); my ($FILE) = $ARGV[0]; # Use custom parameters... my @violations = critique( {-format => 1}, $FILE ); foreach ( @violations ) { print $_,"\n"; }
when I run the above code, It is giving me the following errors
Local lexical variable "$PostTaxVLCCD" is not all lower case or all up +per case at line 721, column 5. See pages 45,46 of PBP. Local lexical variable "$TotalTaxVLCCD" is not all lower case or all u +pper case at line 721, column 5. See pages 45,46 of PBP. Local lexical variable "$PreTaxVLCCD" is not all lower case or all upp +er case at line 721, column 5. See pages 45,46 of PBP. Local lexical variable "$SDRPostTax" is not all lower case or all uppe +r case at line 721, column 5. See pages 45,46 of PBP. Local lexical variable "$Tax" is not all lower case or all upper case +at line 721, column 5. See pages 45,46 of PBP. Local lexical variable "$SDRPreTax" is not all lower case or all upper + case at line 721, column 5. See pages 45,46 of PBP.
When checking the error messages, it is showing like "See pages 45,46 of PBP."....But I want the Severity of the error thrown in the messages I've got. How can I achieve that..just like below in the Perl::Critic documentation
Verbosity Format Specification ----------- ---------------------------------------------------- +--- 1 "%f:%l:%c:%m\n", 2 "%f: (%l:%c) %m\n", 3 "%m at %f line %l\n", 4 "%m at line %l, column %c. %e. (Severity: %s)\n", 5 "%f: %m at line %l, column %c. %e. (Severity: %s)\ +n", 6 "%m at line %l, near '%r'. (Severity: %s)\n", 7 "%f: %m at line %l near '%r'. (Severity: %s)\n", 8 "[%p] %m at line %l, column %c. (Severity: %s)\n", 9 "[%p] %m at line %l, near '%r'. (Severity: %s)\n", 10 "%m at line %l, column %c.\n %p (Severity: %s)\n%d\ +n", 11 "%m at line %l, near '%r'.\n %p (Severity: %s)\n%d\ +n"
Regards, Kalyan
Original content restored above by GrandFather
I'm trying to use the perlcritic command line utility and is outputting all the violations inside my file, How can I distinguish each and every section of the violations. My intention is to parse the output of the perlcritic violations, assign some HTML tags and colors and mail them to the concerned user for fixing the issues.. How can I achieve that?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl::Critic usage
by FalseVinylShrub (Chaplain) on Sep 25, 2009 at 06:04 UTC | |
by kalyanrajsista (Scribe) on Sep 25, 2009 at 09:26 UTC | |
by FalseVinylShrub (Chaplain) on Sep 25, 2009 at 10:06 UTC | |
|
Re: Perl::Critic usage
by toolic (Bishop) on Sep 25, 2009 at 12:52 UTC | |
|
Getting Perl::Critic to emit violation information in the format that you want.
by elliot (Novice) on Sep 26, 2009 at 08:24 UTC |