Perl::Critic::Policy::Mardem::ProhibitBlockComplexity
This Policy approximates the McCabe score within a code block "eg if() {...}".
See http://en.wikipedia.org/wiki/Cyclomatic_complexity
It should help to find complex code block, which should be extracted into subs, to be more testable.
eg. from
if( $a ) { ... ... ... }
to
if( $a ) { do_something(); }
The maximum acceptable McCabe can be set with the max_mccabe configuration item. Any block with a McCabe score higher than this number will generate a policy violation. The default is 10.
max_mccabe
An example section for a .perlcriticrc:
[Mardem::ProhibitBlockComplexity] max_mccabe = 1
This policy is part of Perl::Critic::Mardem.
Markus Demml, mardem@cpan.com
Copyright (c) 2022, Markus Demml
This library is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. The full text of this license can be found in the LICENSE file included with this module.
To install Perl::Critic::Mardem, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perl::Critic::Mardem
CPAN shell
perl -MCPAN -e shell install Perl::Critic::Mardem
For more information on module installation, please visit the detailed CPAN module installation guide.