Skip to content

Commit 0d2099e

Browse files
author
jordanbreen28
committed
(CONT-776) - Correct Style/RedundantRegexpEscape
1 parent 1f01aca commit 0d2099e

File tree

5 files changed

+12
-21
lines changed

5 files changed

+12
-21
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,6 @@ RSpec/StubbedMock:
164164
Exclude:
165165
- 'spec/unit/lib/facter/docker_spec.rb'
166166

167-
# Offense count: 42
168-
# This cop supports safe autocorrection (--autocorrect).
169-
Style/RedundantRegexpEscape:
170-
Exclude:
171-
- 'spec/acceptance/docker_custom_source_spec.rb'
172-
- 'spec/acceptance/docker_full_spec.rb'
173-
- 'spec/acceptance/docker_spec.rb'
174-
- 'spec/classes/compose_spec.rb'
175-
176167
# Offense count: 2
177168
# This cop supports safe autocorrection (--autocorrect).
178169
Style/RedundantSelfAssignmentBranch:

spec/acceptance/docker_custom_source_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
end
3939
else
4040
run_shell('ps aux | grep docker') do |r|
41-
expect(r.stdout).to match %r{dockerd -H unix:\/\/\/var\/run\/docker.sock}
41+
expect(r.stdout).to match %r{dockerd -H unix:///var/run/docker.sock}
4242
end
4343
end
4444
end

spec/acceptance/docker_full_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
end
8989
else
9090
run_shell('ps aux | grep docker') do |r|
91-
expect(r.stdout).to match(%r{dockerd -H unix:\/\/\/var\/run\/docker.sock})
91+
expect(r.stdout).to match(%r{dockerd -H unix:///var/run/docker.sock})
9292
end
9393
end
9494
end
@@ -194,7 +194,7 @@ class { 'docker':
194194
end
195195
else
196196
run_shell('netstat -tulpn | grep docker') do |r|
197-
expect(r.stdout).to match(%r{tcp\s+0\s+0\s+127.0.0.1:4444\s+0.0.0.0\:\*\s+LISTEN\s+\d+\/docker})
197+
expect(r.stdout).to match(%r{tcp\s+0\s+0\s+127.0.0.1:4444\s+0.0.0.0:\*\s+LISTEN\s+\d+/docker})
198198
end
199199
end
200200
end
@@ -218,7 +218,7 @@ class { 'docker':
218218
it 'shows docker listening on the specified unix socket' do
219219
if os[:family] != 'windows'
220220
run_shell('ps aux | grep docker') do |r|
221-
expect(r.stdout).to match(%r{unix:\/\/\/var\/run\/docker.sock})
221+
expect(r.stdout).to match(%r{unix:///var/run/docker.sock})
222222
end
223223
end
224224
end
@@ -505,7 +505,7 @@ class { 'docker': #{docker_args}}
505505
sleep 4
506506

507507
run_shell("#{docker_command} ps") do |r|
508-
expect(r.stdout).to match(%r{#{default_run_command}.+5555\/tcp\, 0\.0\.0.0\:\d+\-\>4444\/tcp})
508+
expect(r.stdout).to match(%r{#{default_run_command}.+5555/tcp, 0\.0\.0.0:\d+->4444/tcp})
509509
end
510510
end
511511

@@ -609,7 +609,7 @@ class { 'docker': #{docker_args} }
609609
sleep 4
610610

611611
run_shell("#{docker_command} inspect container_3_5_5") do |r|
612-
expect(r.stdout).to match(%r{"CpusetCpus"\: "0"})
612+
expect(r.stdout).to match(%r{"CpusetCpus": "0"})
613613
end
614614
end
615615

spec/acceptance/docker_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class { 'docker': #{docker_args} }
118118
apply_manifest(pp, catch_failures: true)
119119
run_shell(shell_command) do |r|
120120
if os[:family] == 'windows'
121-
expect(r.stdout).to match(%r{\"data-root\": \"#{root_dir}\"})
121+
expect(r.stdout).to match(%r{"data-root": "#{root_dir}"})
122122
else
123123
expect(r.stdout).to match(%r{--data-root #{root_dir}})
124124
end
@@ -195,7 +195,7 @@ class { 'docker':
195195
it 'netstat -tlndp' do
196196
result = run_shell('netstat -tlndp')
197197
expect(result[:exit_code]).to eq 0
198-
expect(result[:stdout]).to match %r{0\.0\.0\.0\:80}
198+
expect(result[:stdout]).to match %r{0\.0\.0\.0:80}
199199
end
200200

201201
it 'id testuser | grep docker' do
@@ -235,7 +235,7 @@ class { 'docker':
235235

236236
it 'has a registry mirror set' do
237237
run_shell('ps -aux | grep docker') do |r|
238-
expect(r.stdout).to match(%r{--registry-mirror=http:\/\/testmirror.io})
238+
expect(r.stdout).to match(%r{--registry-mirror=http://testmirror.io})
239239
end
240240
end
241241
end
@@ -255,8 +255,8 @@ class { 'docker':
255255

256256
it 'has all registry mirrors set' do
257257
run_shell('ps -aux | grep docker') do |r|
258-
expect(r.stdout).to match(%r{--registry-mirror=http:\/\/testmirror1.io})
259-
expect(r.stdout).to match(%r{--registry-mirror=http:\/\/testmirror2.io})
258+
expect(r.stdout).to match(%r{--registry-mirror=http://testmirror1.io})
259+
expect(r.stdout).to match(%r{--registry-mirror=http://testmirror2.io})
260260
end
261261
end
262262
end

spec/classes/compose_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
end
7575

7676
if params['proxy'] != :undef
77-
unless %r{^((https?)?:\/\/)?([^:^@]+:[^:^@]+@|)([\da-z\.-]+)\.([\da-z\.]{2,6})(:\d)?([\/\w \.-]*)*\/?$}.match?(params['proxy'])
77+
unless %r{^((https?)?://)?([^:^@]+:[^:^@]+@|)([\da-z.-]+)\.([\da-z.]{2,6})(:\d)?([/\w .-]*)*/?$}.match?(params['proxy'])
7878
it {
7979
expect(subject).to compile.and_raise_error(%r{does not match})
8080
}

0 commit comments

Comments
 (0)