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?


In reply to Perl::Critic usage by kalyanrajsista

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.