3

I need to implement lint and Perl::Critic for static code analysis in Perl. I have found B::Lint module for lint in Perl.

  1. Is it really required to use both the modules for static code analysis?
  2. If yes, then how these two modules work together?
toolic
  • 57,801
  • 17
  • 75
  • 117
mypearl
  • 61
  • 5
  • B::Lint is useful for static code analysis, and finds issues that are different from those addressed by default with Perl::Critic. Perl::Critic could probably be extended easily to address B::Lint's issues. One problem I have with B::Lint is that it doesn't understand certain syntaxes, and gives false warnings. With Perl::Critic one can override such issues using `## no critic (policy_name)` here and there in the target code. B::Lint, from what I can tell, doesn't provide such a facility. – DavidO May 30 '12 at 16:06

1 Answers1

7

B::Lint and Perl::Critic are separate modules.

It is not required to use both modules, but it is useful to use both.

I created a wrapper script for myself to run both in sequence. For example, to analyze a single Perl source code file (file.pl):

perlcritic --brutal --verbose 9 file.pl
perl -MO=Lint file.pl
toolic
  • 57,801
  • 17
  • 75
  • 117