Skip to content

Commit 1562a54

Browse files
committed
(CONT-799) Rubocop Fixes 4-9
- Lint/RedundantCopEnableDirective - Style/IfUnlessModifier - Style/RedundantRegexpEscape - Style/RedundantStringEscape - Style/RescueStandardError
1 parent d230c18 commit 1562a54

File tree

5 files changed

+6
-41
lines changed

5 files changed

+6
-41
lines changed

.rubocop_todo.yml

-32
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 1
10-
# This cop supports safe autocorrection (--autocorrect).
11-
Lint/RedundantCopEnableDirective:
12-
Exclude:
13-
- 'spec/defines/instance_spec.rb'
14-
159
# Offense count: 33
1610
# Configuration parameters: Prefixes, AllowedPatterns.
1711
# Prefixes: when, with, without
@@ -127,37 +121,11 @@ RSpec/RepeatedExampleGroupDescription:
127121
- 'spec/acceptance/listen_spec.rb'
128122
- 'spec/defines/instance_spec.rb'
129123

130-
# Offense count: 1
131-
# This cop supports safe autocorrection (--autocorrect).
132-
Style/IfUnlessModifier:
133-
Exclude:
134-
- 'spec/spec_helper_acceptance_local.rb'
135-
136124
# Offense count: 1
137125
Style/MixinUsage:
138126
Exclude:
139127
- 'spec/spec_helper.rb'
140128

141-
# Offense count: 2
142-
# This cop supports safe autocorrection (--autocorrect).
143-
Style/RedundantRegexpEscape:
144-
Exclude:
145-
- 'spec/defines/instance_spec.rb'
146-
147-
# Offense count: 6
148-
# This cop supports safe autocorrection (--autocorrect).
149-
Style/RedundantStringEscape:
150-
Exclude:
151-
- 'spec/acceptance/mapfile_spec.rb'
152-
153-
# Offense count: 1
154-
# This cop supports safe autocorrection (--autocorrect).
155-
# Configuration parameters: EnforcedStyle.
156-
# SupportedStyles: implicit, explicit
157-
Style/RescueStandardError:
158-
Exclude:
159-
- 'spec/spec_helper.rb'
160-
161129
# Offense count: 159
162130
# This cop supports safe autocorrection (--autocorrect).
163131
# Configuration parameters: EnforcedStyleForMultiline.

spec/acceptance/mapfile_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
file_line {'localhost':
7878
path => '/etc/hosts',
7979
line => '127.0.0.1 localhost host2 host3',
80-
match => '^127\.0\.0\.1',
80+
match => '^127.0.0.1',
8181
}
8282
include ::haproxy
8383
haproxy::mapfile { 'single-mapfile':
@@ -166,7 +166,7 @@
166166
file_line {'localhost':
167167
path => '/etc/hosts',
168168
line => '127.0.0.1 localhost host2 host3',
169-
match => '^127\.0\.0\.1',
169+
match => '^127.0.0.1',
170170
}
171171
include ::haproxy
172172
haproxy::mapfile { 'multiple-mapfiles':

spec/defines/instance_spec.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484

8585
it 'sets the haproxy package' do
8686
subject.should contain_concat__fragment('haproxy-haproxy-base').with_content(
87-
%r{listen stats :9090\n mode http\n stats uri \/\n stats auth puppet:puppet\n},
87+
%r{listen stats :9090\n mode http\n stats uri /\n stats auth puppet:puppet\n},
8888
)
8989
end
9090
end
@@ -310,7 +310,7 @@
310310

311311
it 'sets the haproxy-group1 package' do
312312
subject.should contain_concat__fragment('haproxy-group1-haproxy-base').with_content(
313-
%r{listen stats :9090\n mode http\n stats uri \/\n stats auth puppet:puppet\n},
313+
%r{listen stats :9090\n mode http\n stats uri /\n stats auth puppet:puppet\n},
314314
)
315315
end
316316
end
@@ -666,5 +666,4 @@
666666
}.to raise_error(Puppet::Error, %r{operating system is not supported with the haproxy module})
667667
end
668668
end
669-
# rubocop:enable RSpec/NestedGroups
670669
end

spec/spec_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
begin
2828
default_facts.merge!(YAML.safe_load(File.read(f), [], [], true))
29-
rescue => e
29+
rescue StandardError => e
3030
RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}"
3131
end
3232
end

spec/spec_helper_acceptance_local.rb

+1-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ def retry_on_error_matching(max_retry_count = MAX_RETRY_COUNT, retry_wait_interv
4444

4545
if os[:family] == 'redhat' && os[:release].to_i != 8
4646
epel_owner = 'puppet'
47-
if os[:release].to_i == 6
48-
epel_owner = 'stahnma'
49-
end
47+
epel_owner = 'stahnma' if os[:release].to_i == 6
5048
LitmusHelper.instance.run_shell("puppet module install #{epel_owner}/epel")
5149
if os[:release][0].match?(%r{5|6})
5250
pp = <<-PP

0 commit comments

Comments
 (0)