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: 16288
Status: resolved
Priority: 0/
Queue: Perl-Critic

People
Owner: thaljef [...] cpan.org
Requestors: Bernhard.Schmalhofer [...] biomax.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.13
Fixed in: 0.13_01



Subject: Violation->new() in RequireTrailingCommas.pm
Hi, when running Test::Perl::Critic against my code, I get following error message. # Failed test 'blib/lib/Biomax/My/Module.pm' # in /BioInformatics/soft/perl/lib/site_perl/5.8.0/Test/Perl/Critic.pm at line 83. # # Perl::Critic had errors in 'blib/lib/Biomax/My/Module.pm': # 3rd arg to Violation->new() must be ARRAY ref at /BioInformatics/soft/perl/lib/site_perl/5.8.0/Perl/Critic/Policy/CodeLayout/RequireTrailingCommas.pm line 34 I suppose that the same incorrect call of Violation->new() is lurking in other rules as well.
From: thaljef [...] cpan.org
I haven't seen that before. I double checked the code and it looks reasonable. Also, none of my test cases seem to raise that error. Would you be willing to send me the code that you're running it on? Thanks. -Jeff
From: Bernhard Schmalhofer
[guest - Mon Dec 5 04:29:10 2005]: Show quoted text
> I haven't seen that before. I double checked the code and it looks > reasonable. Also, none of my test cases seem to raise that error. > Would you be willing to send me the code that you're running it on?
Hi Jeff, I have boiled it down to a small test-case and attached the two files. Thinking about it, I find the method calls in hash construction is somewhat questionable by itself. Perhaps I should at least wrap that like my %cds_tag = ( history => join( "\n", @history ), note => scalar( $prot->desc() ), translation => scalar( $prot->seq() ) ); Thanks for that great Module. Right now I just use it for my own code. But I hope to have a handle now, to raise code quality of the whole company. I also have found a documentation glitch, and added a note about it on http://annocpan.org/~THALJEF/Perl-Critic-0.13/lib/Perl/Critic.pm. PS: Sorry that the reply is so late. Initially I replied to comment-Perl-Critic@rt.cpan.org, but it looks like the reply mail never made it back into RT.
use strict; use warnings; use 5.008; sub merge_prot_with_dna { my ( $prot ); my @history; my %cds_tag = ( history => join( "\n", @history ), note => $prot->desc(), translation => $prot->seq() ); return; }
Subject: driver script for Util.p,
And here is the scripts taht actually checks the policy.
# pragmata use strict; use 5.008; use Perl::Critic; # Create Critic and load Policy by hand my $critic = Perl::Critic->new(-profile => 'NONE'); $critic->add_policy( -policy => 'CodeLayout::RequireTrailingCommas' ); $critic->critique( 'Util.pm' );
Thanks for the code sample -- that helped a lot. I think I've traced this to a bug in PPI. For any PPI::Node, the location is given by the location of the first child, but the empty list "()" has no children, so the location is undefined. I'll bring this up with Adam Kennedy (who wrote PPI). In the mean time, I can probably find a workaround for the next release of Perl::Critic, which should be ready by the end of the month. If you want to follow the latest developments, we have a repository at http://perlcritic.tigris.org and a mailing list at dev@perlcritic.tigris.org. -Jeff