You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to make sure that my module or script name matches the file name. A typo is too easy to sneak in, and sometimes I actually use a template, and forget to update the package name.
PerlCritic quickly identifies those mistakes through the [Modules::RequireFilenameMatchesPackage] rule.
However, a couple of mistakes snuck in, and were never flagged!
This is because:
PerlCritic will not enforce the rule if it thinks it is not dealing with a Module file
a Program file identified through --program-extensions
a Module streamed into STDIN
A quick scan of perlcritic/server/src/Output.ts reveals that the Perl source file is not passed as a FILE argument, but as a string piped to STDIN; So PerlCritic has no information to enforce the rule!
This can quickly be verified with an experiment, take any Perl file, where the package name does not match the file name:
I want to make sure that my module or script name matches the file name. A typo is too easy to sneak in, and sometimes I actually use a template, and forget to update the package name.
PerlCritic quickly identifies those mistakes through the [Modules::RequireFilenameMatchesPackage] rule.
However, a couple of mistakes snuck in, and were never flagged!
This is because:
--program-extensions
This can quickly be verified with an experiment, take any Perl file, where the package name does not match the file name:
The first check will flag the name mismatch.
The second and last check will not flag the problem!
The fix is to present
perlcritic
with a file, rather than a string:The text was updated successfully, but these errors were encountered: