Perl-Critic / Perl-Critic-StricterSubs

Perl::Critic plugin for stricter subroutine checks
http://perlcritic.com
Other
8 stars 3 forks source link

Subroutines::ProhibitCallsToUnexportedSubs emits warnings even when there is a "no critic" annotation #19

Open oalders opened 1 year ago

oalders commented 1 year ago

This is related to https://github.com/houseabsolute/precious/pull/32

perlcritic --version
1.140
perl -MPerl::Critic::Policy::Subroutines::ProhibitCallsToUnexportedSubs -e 'print $Perl::Critic::Policy::Subroutines::ProhibitCallsToUnexportedSubs::VERSION'
0.06
use strict;
use warnings;

## no critic (Subroutines::ProhibitCallsToUnexportedSubs)
use Git::Sub qw( config );

my @conf = git::config('--list');

$ cat .perlcriticrc

verbose = 3
severity = 3
program-extensions = pl

[Subroutines::ProhibitCallsToUnexportedSubs]
$ perlcritic git-sub.pl
Subroutines::ProhibitCallsToUnexportedSubs: Cannot find source file "git.pm"
Use of "git::config" without including "git" at git-sub.pl line 7

In this case, there should be no warning and no critic violation. It's not clear to me what's going on here.

petdance commented 6 months ago

I ran into this today and don't know why the no critic isn't working, either. Any insight welcome. I've never messed with no critic internally.

oalders commented 6 months ago

I can take a look under the hood when I get a minute.

klaernie commented 2 weeks ago

The same issue occurs with Modules::RequireExplicitInclusion - could it be, that this happens because the apply to PPI::Documents, not individual tokens?