-1

Hie ,

Perl critic (Source Code Analyser). I am new to this . Although I have studied the documentation and know how to run it (That's not enough!). I want to modify the rules (i.e include,exclude or add my own rules to it). I know .perlcriticrc file can do that. But I don't know how to do it.

Thank you

kanishka
  • 156
  • 1
  • 10

1 Answers1

1

According to the doco for Perl::Critic, you can add a "policy" with the add_policy( -policy => $policy_name, -params => \%param_hash ) method:

-policy is the name of a Perl::Critic::Policy subclass module. The 'Perl::Critic::Policy' portion of the name can be omitted for brevity. This argument is required.

Then, when you look at the linked documentation for the subclass module (emphasis mine);

To work with the Perl::Critic engine, your implementation must behave as described below. For a detailed explanation on how to make new Policy modules, please see the Perl::Critic::DEVELOPER document included in this distribution.

... we see there's a whole document covering exactly what you want to do.

What part of that document are you having trouble with?

Marty
  • 2,788
  • 11
  • 17
  • what to write in the.perlcriticrc file ? what to pass in param_hash ? I am not getting how to start and where to start so that I can modify it . if possible can you please provide me the example of .perlcriticrc that runs properly with default settings of Perl critics and I can understand how should I modify. – kanishka May 26 '16 at 07:13
  • Example .perlcriticrc https://raw.githubusercontent.com/schwern/Perl-Critic/master/examples/perlcriticrc-conway – xxfelixxx May 26 '16 at 07:58
  • http://stackoverflow.com/questions/51499/are-there-any-good-automated-frameworks-for-applying-coding-standards-in-perl?lq=1 – xxfelixxx May 26 '16 at 08:02