File Coverage

blib/lib/Perl/Critic/CognitiveComplexity.pm
Criterion Covered Total %
statement 8 8 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 11 11 100.0


line stmt bran cond sub pod time code
1             package Perl::Critic::CognitiveComplexity;
2 1     1   742 use 5.010;
  1         2  
3 1     1   4 use strict;
  1         1  
  1         19  
4 1     1   11 use warnings;
  1         1  
  1         52  
5              
6             our $VERSION = '0.02';
7              
8              
9              
10             1;
11             __END__
12              
13             =encoding utf-8
14              
15             =head1 NAME
16              
17             Perl::Critic::CognitiveComplexity - Cognitive Complexity, Because Testability != Understandability
18              
19             =head1 DESCRIPTION
20              
21             Perl::Critic::Policy::CognitiveComplexity::ProhibitExcessCognitiveComplexity is a rule that checks the
22             cognitive complexity score of your subroutines. It is based on a new scoring algorithm introduced by
23             SonarSource. See https://blog.sonarsource.com/cognitive-complexity-because-testability-understandability/
24              
25             =head2 Rules
26              
27             =over 1
28              
29             =item L<CognitiveComplexity::ProhibitExcessCognitiveComplexity|Perl::Critic::Policy::CognitiveComplexity::ProhibitExcessCognitiveComplexity> - Avoid code that is nested, and thus difficult to grasp.
30              
31             =back
32              
33             =head2 Configuration
34              
35             The default complexity score before code starts to be reported with medium severity, is 10. This can be changed by changing the C<warn_level> parameter.
36             By default all subroutines with complexity level of more than 0 are reported in lowest severity level. This allows third-party tools to pick up these
37             values as code metrics.
38              
39             [Perl::Critic::Policy::CognitiveComplexity::ProhibitExcessCognitiveComplexity]
40             warn_level = 10
41             info_level = 1
42              
43              
44              
45             =head1 SEE ALSO
46              
47             L<Perl::Critic>
48              
49             =head1 COPYRIGHT
50              
51             Copyright (C) 2017 Oliver Trosien.
52              
53             This library is free software; you can redistribute it and/or modify
54             it under the same terms as Perl itself.
55              
56             =head1 AUTHOR
57              
58             Oliver Trosien E<lt>cpan@pocket-design.deE<gt>
59              
60             =cut