Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

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

People
Owner: Nobody in particular
Requestors: rrwo [...] cpan.org
Cc:
AdminCc:

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



Subject: Settings appear to be ignored in Dist::Zilla
I've added a simple test script: use strict; use warnings; use Test::More; use Test::Perl::Critic -profile => 't/perlcritic.rc'; all_critic_ok(qw/ lib /); When run using prove, the tests pass. But when run using "dzil test", the tests fail because the profile seems to be ignored. It's definitely finding the profile. When I put an invalid path, it shows errors. And when I add nonsense to it, it also shows errors. The configuration just has [TestingAndDebugging::RequireUseStrict] equivalent_modules = common::sense Moops And the failures are Code before strictures are enabled So it seems to be ignoring the setting. The modules that use common::sense fail these tests. Note that manually adding 'use strict' and 'use warnings' to the modules that fail does not remove the error either. The modules literally have the form package Foo::Bar; use strict; use warnings; ... Running "dzil clean" doesn't seem to have any effect.
On 2015-01-30 03:45:15, RRWO wrote: Show quoted text
> And the failures are > > Code before strictures are enabled
... Show quoted text
> > The modules that use common::sense fail these tests. Note that > manually adding 'use strict' and 'use warnings' to the modules that > fail does not remove the error either. The modules literally have the > form > > package Foo::Bar; > > use strict; > use warnings;
Are you *sure* that this is the exact content of the module, after various plugins have munged it? If you're using [PkgVersion], you'll end up with: package Foo::Bar; $Foo::Bar::VERSION = '1.0'; use strict; use warnings; ...which violates "code before strictures". This is why I do this in my modules: use strict; use warnings; package Foo::Bar; ...so the inserted $VERSION will appear after strictures.
Show quoted text
> Are you *sure* that this is the exact content of the module, after various > plugins have munged it?
Yes, that's a good point. Personally, I use [OurPkgVersion] so that *I* can control exactly where the declaration goes.
On Fri Jan 30 13:04:41 2015, ETHER wrote: Show quoted text
> Are you *sure* that this is the exact content of the module, after various > plugins have munged it? If you're using [PkgVersion], you'll end up with: > > package Foo::Bar; > $Foo::Bar::VERSION = '1.0'; > > use strict; > use warnings; > > ...which violates "code before strictures". This is why I do this in my > modules:
Yes, that turns out to be the issue. I didn't think of that, thanks. I do think there should be a section in the Test::Perl::Critic docs about this.
Show quoted text
> I do think there should be a section in the Test::Perl::Critic docs about this.
Great suggestion. I added it in commit 888aac02cbc.