Subject: | [patch] Report subroutine name when violating ProhibitExcessComplexity |
With this patch the subroutine name is reported that violates maxmccabe.
Up to now only the line number was reported which looks like a
programmer was a bit lazy:)
--- lib/Perl/Critic/Policy/Subroutines/ProhibitExcessComplexity.pm~
2008-07-22 16:17:30.000000000 +0200
+++ lib/Perl/Critic/Policy/Subroutines/ProhibitExcessComplexity.pm
2008-10-15 14:42:17.000000000 +0200
@@ -50,8 +50,9 @@
# Is it too complex?
return if $score <= $self->{_max_mccabe};
+ my $name = $elem->name;
- my $desc = qq{Subroutine with high complexity score ($score)};
+ my $desc = qq{Subroutine ($name) with high complexity score ($score)};
return $self->violation( $desc, $EXPL, $elem );
}
Thanks!