Skip to content

Commit 5570da5

Browse files
committed
Lint/EnsureReturn
Returning from an ensure block is a code smell, because it will silently discard whatever was raised (prior to entering the ensure). Make an exception for the configurer code because it's already spaghetti.
1 parent 09b98f5 commit 5570da5

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -585,11 +585,6 @@ Layout/TrailingWhitespace:
585585
Lint/ConstantDefinitionInBlock:
586586
Enabled: false
587587

588-
# This cop supports safe auto-correction (--auto-correct).
589-
Lint/EnsureReturn:
590-
Exclude:
591-
- 'lib/puppet/configurer.rb'
592-
593588
# This cop supports safe auto-correction (--auto-correct).
594589
# Configuration parameters: EnforcedStyle.
595590
# SupportedStyles: standard_error, runtime_error

lib/puppet/configurer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ def run_internal(options)
504504
Puppet.log_exception(detail, _("Failed to apply catalog: %{detail}") % { detail: detail })
505505
return nil
506506
ensure
507-
execute_postrun_command or return nil
507+
execute_postrun_command or return nil # rubocop:disable Lint/EnsureReturn
508508
end
509509
ensure
510510
if Puppet[:resubmit_facts]

0 commit comments

Comments
 (0)