Skip to content

Commit e910fa2

Browse files
committed
[PerlCritic] disable locally some rules
1 parent d3bc177 commit e910fa2

File tree

8 files changed

+20
-0
lines changed

8 files changed

+20
-0
lines changed

perl/gherkin-perl.razor

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ use warnings;
3535

3636
use base 'Gherkin::ParserBase';
3737

38+
## no critic (ProhibitMagicNumbers)
3839
my %states_to_match_names = (
3940
@foreach(var state in Model.States.Values.Where(s => !s.IsEndState)) //..
4041
{
4142
@: @state.Id => 'match_token_at_@(state.Id)',
4243
}
4344
);
45+
## use critic
4446

4547
sub parse {
4648
my ( $self, $token_scanner, $uri ) = @@_;
@@ -94,6 +96,7 @@ sub _construct_parser_error {
9496
return $error_class->new( $token, @@args );
9597
}
9698

99+
## no critic (ProhibitExcessComplexity, ProhibitMagicNumbers, ProhibitPostfixControls)
97100
@foreach(var state in Model.States.Values.Where(s => !s.IsEndState)) //..
98101
{<text>
99102
# @Raw(state.Comment)
@@ -126,6 +129,7 @@ sub match_token_at_@(state.Id) {
126129
</text>
127130
}
128131

132+
## use critic
129133
@foreach(var lookAheadHint in Model.RuleSet.LookAheadHints)
130134
{
131135
<text>

perl/lib/Gherkin.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ sub from_paths {
3939
# accommodates the errors and simply continues, allowing us to
4040
# recode back to octets and then to the encoding indicated in the
4141
# header using the "# encoding: ..." header.
42+
## no critic (RequireEncodingWithUTF8Layer)
4243
open my $fh, '<:utf8', $path
4344
or die "Unable to open gherkin document $path: $!";
45+
## use critic
4446

4547
# local $/ = undef; --> unset 'end-of-line' marker: slurp entire file
4648
# use the 'do' block to scope this binding to smallest possible scope

perl/lib/Gherkin/AstBuilder.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ sub next_id {
165165
return $self->{'id_generator'}->();
166166
}
167167

168+
## no critic (ProhibitExcessComplexity, ProhibitCascadingIfElse)
168169
sub transform_node {
169170
my ( $self, $node ) = @_;
170171

@@ -358,5 +359,6 @@ sub transform_node {
358359
return $node;
359360
}
360361
}
362+
## use critic
361363

362364
1;

perl/lib/Gherkin/Dialect.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ sub new {
2323
close $fh;
2424
$options->{'dictionary'} = Cpanel::JSON::XS::decode_json($input);
2525
} else {
26+
## no critic (ProhibitPackageVars)
2627
require Gherkin::Generated::Languages;
2728
$options->{'dictionary'} = $Gherkin::Generated::Languages::data;
29+
## use critic
2830
}
2931
}
3032

perl/lib/Gherkin/Exceptions.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
## no critic (ProhibitMultiplePackages, RequireExplicitPackage)
2+
13
use strict;
24
use warnings;
35

perl/lib/Gherkin/Generated/Parser.pm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use warnings;
66

77
use base 'Gherkin::ParserBase';
88

9+
## no critic (ProhibitMagicNumbers)
910
my %states_to_match_names = (
1011
0 => 'match_token_at_0',
1112
1 => 'match_token_at_1',
@@ -50,6 +51,7 @@ my %states_to_match_names = (
5051
41 => 'match_token_at_41',
5152
42 => 'match_token_at_42',
5253
);
54+
## use critic
5355

5456
sub parse {
5557
my ( $self, $token_scanner, $uri ) = @_;
@@ -103,6 +105,7 @@ sub _construct_parser_error {
103105
return $error_class->new( $token, @args );
104106
}
105107

108+
## no critic (ProhibitExcessComplexity, ProhibitMagicNumbers, ProhibitPostfixControls)
106109

107110
# Start
108111
sub match_token_at_0 {
@@ -3879,6 +3882,7 @@ sub match_token_at_42 {
38793882
return 42;
38803883
}
38813884

3885+
## use critic
38823886

38833887
sub lookahead_0 {
38843888
my ($self, $context, $current_token) = @_;

perl/lib/Gherkin/ParserBase.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ sub add_error {
4343
return;
4444
}
4545

46+
## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
47+
4648
sub _start_rule {
4749
my ( $self, $context, $ruleType ) = @_;
4850

perl/lib/Gherkin/TokenScanner.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ sub new {
1616

1717
# Perl convention is that a string reference is the string itself, but that
1818
# a straight string is a path
19+
## no critic (RequireBriefOpen)
1920
my $fh;
2021
if ( ref $path_or_str eq 'SCALAR' ) {
2122
my $bytes = Encode::encode('UTF-8', ${ $path_or_str });
@@ -25,6 +26,7 @@ sub new {
2526
|| croak "Can't open [$path_or_str] for reading";
2627
$fh->binmode(':utf8');
2728
}
29+
## use critic
2830

2931
return bless { fh => $fh, line_number => 0 }, $class;
3032
}

0 commit comments

Comments
 (0)