Skip to content

Commit

Permalink
(CONT-792) - Fix broken Acceptance
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanbreen28 committed Apr 19, 2023
1 parent 83be16e commit c12e53c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 14 deletions.
45 changes: 34 additions & 11 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-04-19 16:55:21 UTC using RuboCop version 1.48.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 15
# This cop supports unsafe autocorrection (--autocorrect-all).
Lint/BooleanSymbol:
Expand All @@ -13,16 +21,22 @@ Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/unit/puppet/provider/postgresql_replication_slot/ruby_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Lint/RedundantCopEnableDirective:
Exclude:
- 'spec/unit/puppet/type/postgresql_psql_spec.rb'

# Offense count: 6
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 49
Max: 48

# Offense count: 8
# Offense count: 7
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
# AllowedMethods: refine
Metrics/BlockLength:
Max: 121
Max: 119

# Offense count: 3
# Configuration parameters: AllowedMethods, AllowedPatterns.
Expand All @@ -32,7 +46,7 @@ Metrics/CyclomaticComplexity:
# Offense count: 6
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 31
Max: 29

# Offense count: 1
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
Expand All @@ -59,8 +73,7 @@ Naming/HeredocDelimiterNaming:
- 'spec/defines/server/default_privileges_spec.rb'
- 'spec/defines/server/grant_spec.rb'


# Offense count: 104
# Offense count: 101
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Expand All @@ -76,7 +89,6 @@ RSpec/DescribeClass:
RSpec/ExampleLength:
Max: 53


# Offense count: 3
RSpec/ExpectInHook:
Exclude:
Expand All @@ -96,10 +108,6 @@ RSpec/FilePath:
- 'spec/defines/server/instance/service.rb'
- 'spec/unit/puppet/type/postgresql_conn_validator.rb'


RSpec/NamedSubject:
Enabled: false

# Offense count: 2
RSpec/LeakyConstantDeclaration:
Exclude:
Expand All @@ -119,6 +127,12 @@ RSpec/MultipleExpectations:
RSpec/MultipleMemoizedHelpers:
Max: 18

# Offense count: 208
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Enabled: false

# Offense count: 1
# Configuration parameters: AllowedGroups.
RSpec/NestedGroups:
Expand Down Expand Up @@ -160,6 +174,15 @@ Style/ClassAndModuleChildren:
Exclude:
- 'lib/puppet/util/postgresql_validator.rb'

# Offense count: 3
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
# SupportedStyles: predicate, comparison
Style/NumericPredicate:
Exclude:
- 'spec/**/*'
- 'lib/puppet/type/postgresql_psql.rb'

# Offense count: 2
# Configuration parameters: AllowedMethods.
# AllowedMethods: respond_to_missing?
Expand Down
6 changes: 3 additions & 3 deletions lib/puppet/type/postgresql_psql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def retrieve

def sync
output, status = provider.run_sql_command(value)
raise("Error executing SQL; psql returned #{status}: '#{output}'") unless status.zero?
raise("Error executing SQL; psql returned #{status}: '#{output}'") unless status.to_i.zero?
end
end

Expand All @@ -38,7 +38,7 @@ def sync
# Return true if a matching row is found
def matches(value)
output, status = provider.run_unless_sql_command(value)
fail("Error evaluating 'unless' clause, returned #{status}: '#{output}'") unless status.zero? # rubocop:disable Style/SignalException
fail("Error evaluating 'unless' clause, returned #{status}: '#{output}'") unless status.to_i.zero? # rubocop:disable Style/SignalException

result_count = output.strip.to_i
debug("Found #{result_count} row(s) executing 'unless' clause")
Expand All @@ -59,7 +59,7 @@ def matches(value)
output, status = provider.run_unless_sql_command(value)
status = output.exitcode if status.nil?

raise("Error evaluating 'onlyif' clause, returned #{status}: '#{output}'") unless status.zero?
raise("Error evaluating 'onlyif' clause, returned #{status}: '#{output}'") unless status.to_i.zero?

result_count = output.strip.to_i
debug("Found #{result_count} row(s) executing 'onlyif' clause")
Expand Down

0 comments on commit c12e53c

Please sign in to comment.