Skip to content

Commit ac3b1f7

Browse files
jordanbreen28jordanbreen28
authored andcommitted
(CONT-971) - Correct Style/RedundantRegexpEscape
1 parent 51f7a73 commit ac3b1f7

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

.rubocop_todo.yml

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

219-
# Offense count: 12
220-
# This cop supports safe autocorrection (--autocorrect).
221-
Style/RedundantRegexpEscape:
222-
Exclude:
223-
- 'lib/puppet/provider/filesystem/lvm.rb'
224-
- 'lib/puppet/provider/logical_volume/lvm.rb'
225-
226219
# Offense count: 2
227220
# This cop supports safe autocorrection (--autocorrect).
228221
# Configuration parameters: AllowMultipleReturnValues.

lib/puppet/provider/filesystem/lvm.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def destroy
2020
end
2121

2222
def fstype
23-
%r{\bTYPE=\"(\S+)\"}.match(blkid(@resource[:name]))[1]
23+
%r{\bTYPE="(\S+)"}.match(blkid(@resource[:name]))[1]
2424
rescue Puppet::ExecutionFailure
2525
nil
2626
end

lib/puppet/provider/logical_volume/lvm.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def create
149149

150150
def destroy
151151
name_escaped = "#{@resource[:volume_group].gsub('-', '--')}-#{@resource[:name].gsub('-', '--')}"
152-
if %r{\bTYPE=\"(swap)\"}.match?(blkid(path))
152+
if %r{\bTYPE="(swap)"}.match?(blkid(path))
153153
swapoff(path)
154154
end
155155
dmsetup('remove', name_escaped)
@@ -222,16 +222,16 @@ def size=(new_size)
222222
unless @resource[:resize_fs] == :false || @resource[:resize_fs] == false || @resource[:resize_fs] == 'false'
223223
begin
224224
blkid_type = blkid(path)
225-
if command(:resize4fs) && blkid_type =~ %r{\bTYPE=\"(ext4)\"}
225+
if command(:resize4fs) && blkid_type =~ %r{\bTYPE="(ext4)"}
226226
resize4fs(path) || raise("Cannot resize file system to size #{new_size} because resize2fs failed.")
227-
elsif %r{\bTYPE=\"(ext[34])\"}.match?(blkid_type)
227+
elsif %r{\bTYPE="(ext[34])"}.match?(blkid_type)
228228
resize2fs(path) || raise("Cannot resize file system to size #{new_size} because resize2fs failed.")
229-
elsif %r{\bTYPE=\"(xfs)\"}.match?(blkid_type)
229+
elsif %r{\bTYPE="(xfs)"}.match?(blkid_type)
230230
# New versions of xfs_growfs only support resizing by mount point, not by volume (e.g. under RHEL8)
231231
# * https://tickets.puppetlabs.com/browse/MODULES-9004
232232
mount_point = lsblk('-o', 'MOUNTPOINT', '-nr', path).chomp
233233
xfs_growfs(mount_point) || raise("Cannot resize filesystem to size #{new_size} because xfs_growfs failed.")
234-
elsif %r{\bTYPE=\"(swap)\"}.match?(blkid_type)
234+
elsif %r{\bTYPE="(swap)"}.match?(blkid_type)
235235
(swapoff(path) && mkswap(path) && swapon(path)) || raise("Cannot resize swap to size #{new_size} because mkswap failed.")
236236
end
237237
rescue Puppet::ExecutionFailure => e

0 commit comments

Comments
 (0)