Skip to content

Commit

Permalink
(CONT-792) - Correct Style/StringConcatenation
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanbreen28 committed Apr 19, 2023
1 parent ca4c9a7 commit 6c89748
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 12 deletions.
9 changes: 0 additions & 9 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,6 @@ Style/OptionalBooleanParameter:
- 'lib/puppet/functions/postgresql/postgresql_password.rb'
- 'lib/puppet/type/postgresql_psql.rb'

# Offense count: 3
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Mode.
Style/StringConcatenation:
Exclude:
- 'lib/puppet/functions/postgresql/postgresql_acls_to_resources_hash.rb'
- 'lib/puppet/functions/postgresql/postgresql_password.rb'
- 'lib/puppet/provider/postgresql_psql/ruby.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def default_impl(acls, id, offset)
resource['auth_method'] = parts[3]
resource['auth_option'] = parts.last(parts.length - 4).join(' ') if parts.length > 4
elsif %r{^\d}.match?(parts[4])
resource['address'] = parts[3] + ' ' + parts[4]
resource['address'] = "#{parts[3]} #{parts[4]}"
resource['auth_method'] = parts[5]

resource['auth_option'] = parts.last(parts.length - 6).join(' ') if parts.length > 6
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/functions/postgresql/postgresql_password.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def default_impl(username, password, sensitive = false, hash = 'md5', salt = nil

password = password.unwrap if password.respond_to?(:unwrap)
pass = if hash == 'md5'
'md5' + Digest::MD5.hexdigest(password.to_s + username.to_s)
"md5#{Digest::MD5.hexdigest(password.to_s + username.to_s)}"
else
pg_sha256(password, (salt || username))
end
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/postgresql_psql/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
def run_unless_sql_command(sql)
# for the 'unless' queries, we wrap the user's query in a 'SELECT COUNT',
# which makes it easier to parse and process the output.
run_sql_command('SELECT COUNT(*) FROM (' + sql + ') count')
run_sql_command("SELECT COUNT(*) FROM (#{sql}) count")
end

def run_sql_command(sql)
Expand Down

0 comments on commit 6c89748

Please sign in to comment.