Login
Second attempt to provide warnings when a useless "## no critic"
authorJeffrey Ryan Thalhammer <jeff@imaginative-software.com>
Mon, 27 Oct 2008 03:37:19 +0000 (03:37 +0000)
committerJeffrey Ryan Thalhammer <jeff@imaginative-software.com>
Mon, 27 Oct 2008 03:37:19 +0000 (03:37 +0000)
commit2d2fd1961154a7cfcd31265c2a03887a00997939
tree8d4f7cacacbad80b94830c9961a636d1b3e0fb3d
parent43cf4b1f6f39717f81da58f7d25c101f275a3517
Second attempt to provide warnings when a useless "## no critic"
is found.  This time, I completely re-wrote the way that we
keep track of disabled lines.  Instead of just marking each
line that was affected by a no-critic, I keep track of each
no-critic and the region of lines that it affects.  This
makes it possible to report which no-critic markers are
not having an effect, rather than reporting all the lines
that were disabled but had no violations.

I had a hard time thinking of a good data structure
for expressing all this.  So this certianly isn't the
fastest code.  But this also isn't the slowest part
of Perl-Critic.

Along the way, I found that my strategy for finding
useless no-critic markers was fundamentally flawed --
the most important thing is to keep track of the
violations that were *not* reported.  That way,
you can tell if a no-critic marker was effective
or not.
bin/perlcritic
lib/Perl/Critic.pm
lib/Perl/Critic/Document.pm
t/03_useless_pragmas.t