Skip to content

Commit 4d95ef7

Browse files
author
jordanbreen28
committed
(CONT-792) - Correct Layout/EmptyLineAfterGuardClause
1 parent 02305d0 commit 4d95ef7

File tree

5 files changed

+6
-10
lines changed

5 files changed

+6
-10
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
# Offense count: 6
2-
# This cop supports safe autocorrection (--autocorrect).
3-
Layout/EmptyLineAfterGuardClause:
4-
Exclude:
5-
- 'lib/puppet/functions/postgresql/postgresql_password.rb'
6-
- 'lib/puppet/provider/postgresql_replication_slot/ruby.rb'
7-
- 'lib/puppet/type/postgresql_psql.rb'
8-
- 'tasks/sql.rb'
9-
10-
# Offense count: 80
111
# This cop supports safe autocorrection (--autocorrect).
122
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
133
# SupportedHashRocketStyles: key, separator, table

lib/puppet/functions/postgresql/postgresql_password.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def default_impl(username, password, sensitive = false, hash = 'md5', salt = nil
3131
if password.is_a?(String) && password.match?(%r{^(md5|SCRAM-SHA-256).+})
3232
return password
3333
end
34+
3435
password = password.unwrap if password.respond_to?(:unwrap)
3536
pass = if hash == 'md5'
3637
'md5' + Digest::MD5.hexdigest(password.to_s + username.to_s)

lib/puppet/provider/postgresql_replication_slot/ruby.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ def exists?
2828
def create
2929
output = self.class.run_sql_command("SELECT * FROM pg_create_physical_replication_slot('#{resource[:name]}');")
3030
raise Puppet::Error, "Failed to create replication slot #{resource[:name]}:\n#{output[0]}" unless output[1].success?
31+
3132
@property_hash[:ensure] = :present
3233
end
3334

3435
def destroy
3536
output = self.class.run_sql_command("SELECT pg_drop_replication_slot('#{resource[:name]}');")
3637
raise Puppet::Error, "Failed to destroy replication slot #{resource[:name]}:\n#{output[0]}" unless output[1].success?
38+
3739
@property_hash[:ensure] = :absent
3840
end
3941

lib/puppet/type/postgresql_psql.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def matches(value)
6161
status = output.exitcode if status.nil?
6262

6363
raise("Error evaluating 'onlyif' clause, returned #{status}: '#{output}'") unless status.zero?
64+
6465
result_count = output.strip.to_i
6566
debug("Found #{result_count} row(s) executing 'onlyif' clause")
6667
result_count.positive?
@@ -140,6 +141,7 @@ def should_run_sql(refreshing = false)
140141
return false if !onlyif_param.nil? && !onlyif_param.value.nil? && !onlyif_param.matches(onlyif_param.value)
141142
return false if !unless_param.nil? && !unless_param.value.nil? && unless_param.matches(unless_param.value)
142143
return false if !refreshing && @parameters[:refreshonly].value == :true
144+
143145
true
144146
end
145147

tasks/sql.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def get(sql, database, user, port, password, host)
1515
cmd_string << "--host=#{host}" unless host.nil?
1616
stdout, stderr, status = Open3.capture3(env_hash, *cmd_string)
1717
raise Puppet::Error, stderr if status != 0
18+
1819
{ status: stdout.strip }
1920
end
2021

0 commit comments

Comments
 (0)