Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Perl-Critic CPAN distribution.

Report information
The Basics
Id: 24699
Status: resolved
Priority: 0/
Queue: Perl-Critic

People
Owner: Nobody in particular
Requestors: Ken.Schafer [...] mathworks.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: "John Micco" <John.Micco [...] mathworks.com>, "Yu Wang" <Yu.Wang [...] mathworks.com>, "Ken Schafer" <Ken.Schafer [...] mathworks.com>
Subject: The Perl Critic complexity module only evaluates code contained in a subroutine
Date: Wed, 31 Jan 2007 15:06:37 -0500
To: <bug-Perl-Critic [...] rt.cpan.org>
From: "Ken Schafer" <Ken.Schafer [...] mathworks.com>
The complexity module only evaluates code contained in a subroutine. It would be better if all code was evaluated, especially for scripts that do not have any subroutines. Thank you, Ken Schafer kschafer@mathworks.com 508-647-8008
Great suggestion. Do you think it should use the same complexity limit as the subroutines? Or should there be a separate limit for non- subroutine code? BTW: I really like Brian Foy's modulina pattern. That way, you never have more than one (real) line of code that is not in a subroutine. And it makes it easy to test the subroutines in your scripts. For example: package Foo; use strict; use warnings; use Bar::Baz; exit run() if not caller; sub run{ #everything happens in here #return 0 on success, >0 on error my $frob = frobulate( @ARGV ); $frob->fornicate( 42 ); #yadda ... yadda }
CC: "Yu Wang" <Yu.Wang [...] mathworks.com>, "John Micco" <John.Micco [...] mathworks.com>
Subject: RE: [rt.cpan.org #24699] The Perl Critic complexity module only evaluates code contained in a subroutine
Date: Mon, 5 Feb 2007 10:20:05 -0500
To: <bug-Perl-Critic [...] rt.cpan.org>
From: "Ken Schafer" <Ken.Schafer [...] mathworks.com>
Hi Jeffery, For our purposes, it would be better to have the same complexity limit as the subroutines. We would like the complexity evaluation to be as consistent as possible. I agree with you completely on the modulina pattern. Unfortunately we have a lot of legacy code that is not written is this manner. We are using complexity as one of our criteria for selecting code to refactor first. Thanks, Ken Show quoted text
-----Original Message----- From: Jeffrey Thalhammer via RT [mailto:bug-Perl-Critic@rt.cpan.org] Sent: Sunday, February 04, 2007 5:33 PM To: Ken Schafer Subject: [rt.cpan.org #24699] The Perl Critic complexity module only evaluates code contained in a subroutine <URL: http://rt.cpan.org/Ticket/Display.html?id=24699 > Great suggestion. Do you think it should use the same complexity limit as the subroutines? Or should there be a separate limit for non- subroutine code? BTW: I really like Brian Foy's modulina pattern. That way, you never have more than one (real) line of code that is not in a subroutine. And it makes it easy to test the subroutines in your scripts. For example: package Foo; use strict; use warnings; use Bar::Baz; exit run() if not caller; sub run{ #everything happens in here #return 0 on success, >0 on error my $frob = frobulate( @ARGV ); $frob->fornicate( 42 ); #yadda ... yadda }
This feature is now available on CPAN in Perl-Critic-1.06. The policy is named Modules::ProhibitExcessMainComplexity. Thanks for the suggestion.