Add expect_stderr = true to Perl::Critic example#32
Add expect_stderr = true to Perl::Critic example#32oalders wants to merge 1 commit intohouseabsolute:masterfrom oalders:perlcritic-example
Conversation
Perl::Critic can emit a warning without claiming that there has been a violation: https://metacpan.org/release/PETDANCE/Perl-Critic-StricterSubs-0.06/source/lib/Perl/Critic/Policy/Subroutines/ProhibitCallsToUnexportedSubs.pm#L198 This one bit me because I copy/pasted the example from this repo and just one file started failing for seemingly mysterious reasons.
|
Please merge as you see fit. It's not October yet. |
|
Is that warning not something you want to fail on? It's not clear to me from the code whether it represents a failure or something you can ignore. |
use strict;
use warnings;
use Git::Sub qw( config );
my @conf = git::config('--list');perlcritic --noprofile --single-policy Subroutines::ProhibitCallsToUnexportedSubs git-sub.pl
Subroutines::ProhibitCallsToUnexportedSubs: Cannot find source file "git.pm"
Subroutine "config" not exported by "git" at line 6, column 12. Violates encapsulation. (Severity: 4)I think that warning is a shortcoming of the logic in that particular policy. See https://metacpan.org/pod/Perl::Critic::Policy::Subroutines::ProhibitCallsToUnexportedSubs#LIMITATIONS So, the violation is correct, but the warning should not be what causes the failure.
Maybe @petdance has an opinion on this? I will open a related ticket on the |
|
I think a better fix might be to add a new |
|
Yes, that sounds a lot more flexible. |
|
I just release v0.3.0 with the new |
Perl::Critic can emit a warning without claiming that there has been a
violation:
https://metacpan.org/release/PETDANCE/Perl-Critic-StricterSubs-0.06/source/lib/Perl/Critic/Policy/Subroutines/ProhibitCallsToUnexportedSubs.pm#L198
This one bit me because I copy/pasted the example from this repo and
just one file started failing for seemingly mysterious reasons.