-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modules::RequireExplicitInclusion trips on structures in constant.pm #12
Comments
This is a bummer for me, too. I've got a couple of modules where I have to |
I'm not familiar with Perl::Critic::Utils, but adding these checks to https://github.com/Perl-Critic/Perl-Critic-StricterSubs/blob/master/lib/Perl/Critic/Policy/Modules/RequireExplicitInclusion.pm#L102 solved it for me
|
I thought about this further and I'm not sure why it trips. If it sees So it seems like these are mutually exclusive. Furthermore, if we make it skip variables ( Basically: $Foo::Bar = ...; # Don't trip (or at most, make it configurable)
FOO->{...}; # Don't trip. Definitely a constant and not a method of a class
FOO::BAR->{...}; # Violation! Definitely sub call in class 'FOO', whether constant or not.
FOO::BAR(); # Violation! Definitely sub call. It's very possible the above suggestion fixes this exact issue. |
What do those checks do? |
From what I understand reading
I added a check that -> is followed by a word, not sure if |
Whatever change gets made to handle this case, we definitely need tests that check for the behavior and that it doesn't break other behavior. |
If I set a construct with
constant.pm
, it will tripModules::RequireExplicitInclusion
. For example:Has the following failures:
This is hard to detect, but maybe we need a configuration option that only flags methods and fuctions, rather than hash or array calls.
The text was updated successfully, but these errors were encountered: