Skip to content

Commit 92b5a8d

Browse files
jordanbreen28jordanbreen28
authored andcommitted
(CONT-971) - Correct Style/StringConcatenation
1 parent cd1fcd2 commit 92b5a8d

36 files changed

+66
-81
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -217,19 +217,6 @@ Style/OptionalBooleanParameter:
217217
- 'tests/beaker/lib/lvm_helper.rb'
218218

219219

220-
# Offense count: 1
221-
# This cop supports safe autocorrection (--autocorrect).
222-
# Configuration parameters: AllowModifier.
223-
Style/SoleNestedConditional:
224-
Exclude:
225-
- 'lib/puppet/provider/filesystem/aix.rb'
226-
227-
# Offense count: 68
228-
# This cop supports unsafe autocorrection (--autocorrect-all).
229-
# Configuration parameters: Mode.
230-
Style/StringConcatenation:
231-
Enabled: false
232-
233220
# Offense count: 3
234221
# This cop supports unsafe autocorrection (--autocorrect-all).
235222
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.

lib/puppet/provider/logical_volume/lvm.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ def create
137137
if @resource[:thinpool]
138138
args.push('--thin')
139139
args << if @resource[:thinpool].is_a? String
140-
@resource[:volume_group] + '/' + @resource[:thinpool]
140+
"#{@resource[:volume_group]}/#{@resource[:thinpool]}"
141141
else
142-
@resource[:volume_group] + '/' + @resource[:name]
142+
"#{@resource[:volume_group]}/#{@resource[:name]}"
143143
end
144144
else
145145
args << @resource[:volume_group]
@@ -179,7 +179,7 @@ def size
179179
return unless raw =~ %r{\s+(\d+)\.(\d+)#{unit}}i
180180
return Regexp.last_match(1) + unit.capitalize if Regexp.last_match(2).to_i.zero?
181181

182-
Regexp.last_match(1) + '.' + Regexp.last_match(2).sub(%r{0+$}, '') + unit.capitalize
182+
"#{Regexp.last_match(1)}.#{Regexp.last_match(2).sub(%r{0+$}, '')}#{unit.capitalize}"
183183
end
184184

185185
def size=(new_size)

lib/puppet/type/logical_volume.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,7 @@ def insync?(is)
206206
desc 'An optimization in lvcreate, at least on Linux.'
207207
end
208208
newparam(:region_size) do
209-
desc 'A mirror is divided into regions of this size (in MB), the mirror log uses this granularity to track which regions are in sync. ' \
210-
+'CAN NOT BE CHANGED on already mirrored volume. Take your mirror size in terabytes and round up that number to the next power of 2, ' \
211-
+'using that number as the -R argument.'
209+
desc 'A mirror is divided into regions of this size (in MB), the mirror log uses this granularity to track which regions are in sync. CAN NOT BE CHANGED on already mirrored volume. Take your mirror size in terabytes and round up that number to the next power of 2, using that number as the -R argument.'
212210
validate do |value|
213211
unless %r{^[0-9]+$}i.match?(value.to_s)
214212
raise ArgumentError, "#{value} is not a valid region size in MB."

lib/puppet/type/volume_group.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def insync?(is)
2020
should.each do |s|
2121
if File.symlink?(s)
2222
device = File.expand_path(File.readlink(s), File.dirname(s))
23-
debug("resolved symlink '" + s + "' to device '" + device + "'")
23+
debug("resolved symlink '#{s}' to device '#{device}'")
2424
real_should.push device
2525
else
2626
real_should.push s
@@ -29,7 +29,7 @@ def insync?(is)
2929
is.each do |s|
3030
if File.symlink?(s)
3131
device = File.expand_path(File.readlink(s), File.dirname(s))
32-
debug("resolved symlink '" + s + "' to device '" + device + "'")
32+
debug("resolved symlink '#{s}' to device '#{device}'")
3333
real_is.push device
3434
else
3535
real_is.push s

spec/lib/helpers.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
module Helpers
4-
TEST_DIR = Pathname.new(__FILE__).parent + '..'
4+
TEST_DIR = "#{Pathname.new(__FILE__).parent}.."
55

66
TYPES = {
77
pv: :physical_volume,
@@ -58,6 +58,6 @@ def stub_default_provider!
5858
end
5959

6060
def fixture(name, ext = '.txt')
61-
(TEST_DIR + 'fixtures' + "#{name}#{ext}").read
61+
"#{TEST_DIR}fixtures#{name}#{ext}".read
6262
end
6363
end

tests/beaker/tests/aix/create_lv_with_param_max_range.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
# initilize
1010
pv = 'hdisk1'
11-
vg = 'VG_' + SecureRandom.hex(2)
12-
lv = 'LV_' + SecureRandom.hex(3)
11+
vg = "VG_#{SecureRandom.hex(2)}"
12+
lv = "LV_#{SecureRandom.hex(3)}"
1313

1414
# Teardown
1515
teardown do

tests/beaker/tests/aix/create_lv_with_param_min_range.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
# initilize
1010
pv = 'hdisk1'
11-
vg = 'VG_' + SecureRandom.hex(2)
12-
lv = 'LV_' + SecureRandom.hex(3)
11+
vg = "VG_#{SecureRandom.hex(2)}"
12+
lv = "LV_#{SecureRandom.hex(3)}"
1313

1414
# Teardown
1515
teardown do

tests/beaker/tests/aix/create_lv_with_param_type.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
# initilize
1010
pv = 'hdisk1'
11-
vg = 'VG_' + SecureRandom.hex(2)
12-
lv = 'LV_' + SecureRandom.hex(3)
11+
vg = "VG_#{SecureRandom.hex(2)}"
12+
lv = "LV_#{SecureRandom.hex(3)}"
1313

1414
# Teardown
1515
teardown do

tests/beaker/tests/aix/create_volume_group_on_aix.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# initilize
1010
pv = 'hdisk1'
11-
vg = 'VG_' + SecureRandom.hex(2)
11+
vg = "VG_#{SecureRandom.hex(2)}"
1212

1313
# Teardown
1414
teardown do

tests/beaker/tests/create_filesystem_non-existing-format.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
# initilize
1010
pv = '/dev/sdc'
11-
vg = ('VolumeGroup_' + SecureRandom.hex(2))
12-
lv = ('LogicalVolume_' + SecureRandom.hex(3))
11+
vg = "VolumeGroup_#{SecureRandom.hex(2)}"
12+
lv = "LogicalVolume_#{SecureRandom.hex(3)}"
1313

1414
# Teardown
1515
teardown do

0 commit comments

Comments
 (0)