Skip to content

Commit 973e15b

Browse files
author
jordanbreen28
committed
(CONT-792) - Correct Style/RedundantRegexpEscape
1 parent 53c8642 commit 973e15b

File tree

5 files changed

+7
-15
lines changed

5 files changed

+7
-15
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,6 @@ Style/OptionalBooleanParameter:
168168
- 'lib/puppet/functions/postgresql/postgresql_password.rb'
169169
- 'lib/puppet/type/postgresql_psql.rb'
170170

171-
# Offense count: 7
172-
# This cop supports safe autocorrection (--autocorrect).
173-
Style/RedundantRegexpEscape:
174-
Exclude:
175-
- 'lib/puppet/provider/postgresql_conf/parsed.rb'
176-
- 'lib/puppet/type/postgresql_conf.rb'
177-
- 'spec/defines/server/pg_hba_rule_spec.rb'
178-
- 'spec/spec_helper_acceptance_local.rb'
179171

180172
# Offense count: 2
181173
# This cop supports safe autocorrection (--autocorrect).

lib/puppet/provider/postgresql_conf/parsed.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
record_line :parsed,
1717
fields: ['name', 'value', 'comment'],
1818
optional: ['comment'],
19-
match: %r{^\s*([\w\.]+)\s*=?\s*(.*?)(?:\s*#\s*(.*))?\s*$},
19+
match: %r{^\s*([\w.]+)\s*=?\s*(.*?)(?:\s*#\s*(.*))?\s*$},
2020
to_line: proc { |h|
2121
# simple string and numeric values don't need to be enclosed in quotes
2222
val = if h[:value].is_a?(Numeric)

lib/puppet/type/postgresql_conf.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
desc 'The postgresql parameter name to manage.'
1010
isnamevar
1111

12-
newvalues(%r{^[\w\.]+$})
12+
newvalues(%r{^[\w.]+$})
1313
end
1414

1515
newproperty(:value) do

spec/defines/server/pg_hba_rule_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class { 'postgresql::server': }
3030
end
3131

3232
it do
33-
expect(subject).to contain_concat__fragment('pg_hba_rule_test').with(content: %r{host\s+all\s+all\s+1\.1\.1\.1\/24\s+md5})
33+
expect(subject).to contain_concat__fragment('pg_hba_rule_test').with(content: %r{host\s+all\s+all\s+1\.1\.1\.1/24\s+md5})
3434
end
3535
end
3636

@@ -76,7 +76,7 @@ class { 'postgresql::server': }
7676
end
7777

7878
it do
79-
expect(subject).to contain_concat__fragment('pg_hba_rule_test').with(content: %r{host\s+all\s+all\s+0\.0\.0\.0\/0\s+ldap\s+foo=bar})
79+
expect(subject).to contain_concat__fragment('pg_hba_rule_test').with(content: %r{host\s+all\s+all\s+0\.0\.0\.0/0\s+ldap\s+foo=bar})
8080
end
8181
end
8282

@@ -104,7 +104,7 @@ class { 'postgresql::server': }
104104

105105
it do
106106
expect(subject).to contain_concat__fragment('pg_hba_rule_test').with(
107-
content: %r{local\s+all\s+all\s+0\.0\.0\.0\/0\s+peer},
107+
content: %r{local\s+all\s+all\s+0\.0\.0\.0/0\s+peer},
108108
)
109109
end
110110
end
@@ -132,7 +132,7 @@ class { 'postgresql::server': }
132132

133133
it do
134134
expect(subject).to contain_concat__fragment('pg_hba_rule_test').with(
135-
content: %r{local\s+all\s+all\s+0\.0\.0\.0\/0\s+scram-sha-256},
135+
content: %r{local\s+all\s+all\s+0\.0\.0\.0/0\s+scram-sha-256},
136136
)
137137
end
138138
end

spec/spec_helper_acceptance_local.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def shellescape(str)
8585
# Treat multibyte characters as is. It is caller's responsibility
8686
# to encode the string in the right encoding for the shell
8787
# environment.
88-
str.gsub!(%r{([^A-Za-z0-9_\-.,:\/@\n])}, '\\\\\\1')
88+
str.gsub!(%r{([^A-Za-z0-9_\-.,:/@\n])}, '\\\\\\1')
8989

9090
# A LF cannot be escaped with a backslash because a backslash + LF
9191
# combo is regarded as line continuation and simply ignored.

0 commit comments

Comments
 (0)