| 1 | package Perl::Critic::Policy::Bangs::ProhibitFlagComments; | ||||||||||
| 2 | |||||||||||
| 3 | 5 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 5 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 5 | ▶ | use Perl::Critic::Utils; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 5 | ▶ | use base 'Perl::Critic::Policy'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 5 | our $VERSION = '1.14'; | |||||||||
| 9 | |||||||||||
| 10 | #---------------------------------------------------------------------------- | ||||||||||
| 11 | |||||||||||
| 12 | 9 | ▶ | sub supported_parameters { | ||||||||
|
Subroutine
supported_parameters: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 13 | return ( | ||||||||||
| 14 | { | ||||||||||
| 15 | 9 | name => 'keywords', | |||||||||
| 16 | description => 'Words to prohibit in comments.', | ||||||||||
| 17 | behavior => 'string list', | ||||||||||
| 18 | default_string => 'XXX FIXME TODO', | ||||||||||
| 19 | }, | ||||||||||
| 20 | ); | ||||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | 5 | ▶ | sub default_severity { return $SEVERITY_LOW } | ||||||||
|
Subroutine
default_severity: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 24 | 0 | ▶ | sub default_themes { return qw( bangs maintenance ) } | ||||||||
|
Subroutine
default_themes: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 25 | 5 | ▶ | sub applies_to { return qw( PPI::Token::Comment PPI::Token::Pod ) } | ||||||||
|
Subroutine
applies_to: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 26 | |||||||||||
| 27 | |||||||||||
| 28 | #--------------------------------------------------------------------------- | ||||||||||
| 29 | |||||||||||
| 30 | 16 | ▶ | sub violates { | ||||||||
|
Subroutine
violates: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 31 | 16 | my ( $self, $elem, $doc ) = @_; | |||||||||
| 32 | |||||||||||
| 33 | 16 | foreach my $keyword ( keys %{ $self->{'_keywords'} } ) { | |||||||||
| 34 | 31 | ▶ | if ( $elem->content() =~ /\b\Q$keyword\E\b/ ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 5 | my $desc = qq(Flag comment '$keyword' found); | |||||||||
| 36 | 5 | my $expl = qq(Comments containing "$keyword" typically indicate bugs or problems that the developer knows exist); | |||||||||
| 37 | 5 | return $self->violation( $desc, $expl, $elem ); | |||||||||
| 38 | } | ||||||||||
| 39 | } | ||||||||||
| 40 | 11 | return; | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 5 | 1; | |||||||||
| 44 | |||||||||||
| 45 | __END__ | ||||||||||