Perlcritic is not working

Get a bunch of errors when runnig perlcritic, have i miss any thing our is it a bug?

Windows 10 Home / Ver 21H2
Microsoft Defender Antivirus

Activestate perl-5.36

test.pl
use v5.36;
use strict;
use warnings;
say sin(45 * 3.141592 / 180) / cos(45 * 3.141592 / 180);

and when i run
perlcritic --brutal test.pl i get some error.
Any fix for my problem ?

[je-strom/Perl-5.36.0-Windows] P:>perlcritic --brutal test.pl
Exception::Fatal::Generic: A general problem was found.

No Policies found in namespace “Perl::Critic::Policy”.

Tue Sep 13 17:44:06 2022

Trace begun at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic\PolicyFactory.pm line 68
Perl::Critic::PolicyFactory::import(‘Perl::Critic::PolicyFactory’) called at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic\Config.pm line 17
Perl::Critic::Config::BEGIN at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic\Config.pm line 17
eval {…} at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic\Config.pm line 17
require Perl/Critic/Config.pm at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic.pm line 17
Perl::Critic::BEGIN at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic.pm line 17
eval {…} at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic.pm line 17
require Perl/Critic.pm at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic\Command.pm line 230
Perl::Critic::Command::_critique(‘HASH(0x34cd190)’, ‘test.pl’) called at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic\Command.pm line 64
Perl::Critic::Command::run at C:\users\je\appdata\local\activestate\cache\cc60d19f\site\bin\perlcritic.bat line 34
BEGIN failed–compilation aborted at C:/Users/je/AppData/Local/ActiveState/cache/cc60d19f/site/lib/Perl/Critic/Config.pm line 17.
Compilation failed in require at C:/Users/je/AppData/Local/ActiveState/cache/cc60d19f/site/lib/Perl/Critic.pm line 17.
BEGIN failed–compilation aborted at C:/Users/je/AppData/Local/ActiveState/cache/cc60d19f/site/lib/Perl/Critic.pm line 17.
Compilation failed in require at C:/Users/je/AppData/Local/ActiveState/cache/cc60d19f/site/lib/Perl/Critic/Command.pm line 230.

Have you tried using the command line option to specify a Policies file?

My suspicion is that your perlcritic installation either does not have .perlcriticrc default file, or does not know where to locate it relative to where it is installed.

Hi, thanks for the suggestions.

Feel like I’m in deep water now!
But I tried creating a .perlcriticrc with the following

[TestingAndDebugging::RequireUseStrict]
severity = 5
[TestingAndDebugging::RequireUseWarnings]
severity = 5

and tried
perlcritic --profile .perlcriticrc test.pl

and got

[je-strom/Perl-5.36.0-Windows] P:>perlcritic --profile .perlcriticrc test.pl
Exception::Fatal::Generic: A general problem was found.

No Policies found in namespace “Perl::Critic::Policy”.

Fri Sep 16 18:15:46 2022

Trace began at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic\PolicyFactory.pm line 68
Perl::Critic::PolicyFactory::import(‘Perl::Critic::PolicyFactory’) called at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic\Config. pm line 17
Perl::Critic::Config::BEGIN at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic\Config.pm line 17
eval {…} at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic\Config.pm line 17
require Perl/Critic/Config.pm at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic.pm line 17
Perl::Critic::BEGIN at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic.pm line 17
eval {…} at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic.pm line 17
require Perl/Critic.pm at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic\Command.pm line 230
Perl::Critic::Command::_critique(‘HASH(0x3430690)’, ‘test.pl’) called at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic \Command.pm line 64
Perl::Critic::Command::run at C:\users\je\appdata\local\activestate\cache\cc60d19f\site\bin\perlcritic.bat line 34
BEGIN failed–compilation aborted at C:/Users/je/AppData/Local/ActiveState/cache/cc60d19f/site/lib/Perl/Critic/Config.pm line 17.
Compilation failed in require at C:/Users/je/AppData/Local/ActiveState/cache/cc60d19f/site/lib/Perl/Critic.pm line 17.
BEGIN failed–compilation aborted at C:/Users/je/AppData/Local/ActiveState/cache/cc60d19f/site/lib/Perl/Critic.pm line 17.
Compilation failed in require at C:/Users/je/AppData/Local/ActiveState/cache/cc60d19f/site/lib/Perl/Critic/Command.pm line 230.

and then also

perlcritic --noprofile --brutal test.pl

and got

[je-strom/Perl-5.36.0-Windows] P:>perlcritic --noprofile --brutal test.pl
Exception::Fatal::Generic: A general problem was found.

No Policies found in namespace “Perl::Critic::Policy”.

Fri Sep 16 18:19:23 2022

Trace began at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic\PolicyFactory.pm line 68
Perl::Critic::PolicyFactory::import(‘Perl::Critic::PolicyFactory’) called at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic\Config. pm line 17
Perl::Critic::Config::BEGIN at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic\Config.pm line 17
eval {…} at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic\Config.pm line 17
require Perl/Critic/Config.pm at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic.pm line 17
Perl::Critic::BEGIN at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic.pm line 17
eval {…} at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic.pm line 17
require Perl/Critic.pm at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic\Command.pm line 230
Perl::Critic::Command::_critique(‘HASH(0x3481610)’, ‘test.pl’) called at C:\Users\je\AppData\Local\ActiveState\cache\cc60d19f\site\lib\Perl\Critic \Command.pm line 64
Perl::Critic::Command::run at C:\users\je\appdata\local\activestate\cache\cc60d19f\site\bin\perlcritic.bat line 34
BEGIN failed–compilation aborted at C:/Users/je/AppData/Local/ActiveState/cache/cc60d19f/site/lib/Perl/Critic/Config.pm line 17.
Compilation failed in require at C:/Users/je/AppData/Local/ActiveState/cache/cc60d19f/site/lib/Perl/Critic.pm line 17.
BEGIN failed–compilation aborted at C:/Users/je/AppData/Local/ActiveState/cache/cc60d19f/site/lib/Perl/Critic.pm line 17.
Compilation failed in require at C:/Users/je/AppData/Local/ActiveState/cache/cc60d19f/site/lib/Perl/Critic/Command.pm line 230.

Je-Strom,

We have found the root cause of this problem - unfortunately I can’t send the solution back to 2022, but we and will shortly be implementing a fix.

The issue here is that perlcritic transitively relies on File::Find to search for Policy Modules, and File::Find is constructing the search path incorrectly on Windows. This behavior has been fixed in Perl 5.38+ – History for ext/File-Find/lib/File/Find.pm - Perl/perl5 · GitHub

Perlcritic currently works in Perl 5.38+, We are backporting the fixes into Perls 5.36, and 5.34. So this problem should disappear entirely in ActivePerl 5.34+ sometime next week.

Best,
Marc