Skip to content

Commit 2aa8a61

Browse files
committed
(PUP-11993) Style/Proc
This commit enables the Style/Proc cop and fixes 4 autocorrectable offenses.
1 parent d6adaf7 commit 2aa8a61

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -646,13 +646,6 @@ Style/OptionalBooleanParameter:
646646
Style/PreferredHashMethods:
647647
Enabled: false
648648

649-
# This cop supports safe auto-correction (--auto-correct).
650-
Style/Proc:
651-
Exclude:
652-
- 'lib/puppet/pops/evaluator/deferred_resolver.rb'
653-
- 'lib/puppet/pops/lookup/hiera_config.rb'
654-
- 'lib/puppet/util/windows/daemon.rb'
655-
656649
# This cop supports safe auto-correction (--auto-correct).
657650
# Configuration parameters: EnforcedStyle, AllowedCompactTypes.
658651
# SupportedStyles: compact, exploded

lib/puppet/pops/evaluator/deferred_resolver.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def resolve_future(f)
172172
else
173173
# call the function later
174174
DeferredValue.new(
175-
Proc.new {
175+
proc {
176176
# deferred functions can have nested deferred arguments
177177
resolved_arguments = mapped_arguments.map { |arg| resolve_lazy_args(arg) }
178178
@scope.call_function(func_name, resolved_arguments)

lib/puppet/pops/lookup/hiera_config.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def create_hiera3_backend_provider(name, backend, parent_data_provider, datadir,
308308
# Replace the class methods 'hiera_interpolate' and 'alias_interpolate' with a method that wires back and performs global
309309
# lookups using the lookup framework. This is necessary since the classic Hiera is made aware only of custom backends.
310310
class << Hiera::Interpolate
311-
hiera_interpolate = Proc.new do |_data, key, scope, _extra_data, context|
311+
hiera_interpolate = proc do |_data, key, scope, _extra_data, context|
312312
override = context[:order_override]
313313
invocation = Puppet::Pops::Lookup::Invocation.current
314314
unless override.nil? && invocation.global_only?

lib/puppet/util/windows/daemon.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class Daemon
7474
NO_ERROR = 0
7575

7676
# Wraps SetServiceStatus.
77-
SetTheServiceStatus = Proc.new do |dwCurrentState, dwWin32ExitCode, dwCheckPoint, dwWaitHint|
77+
SetTheServiceStatus = proc do |dwCurrentState, dwWin32ExitCode, dwCheckPoint, dwWaitHint|
7878
ss = SERVICE_STATUS.new # Current status of the service.
7979

8080
# Disable control requests until the service is started.
@@ -105,7 +105,7 @@ class Daemon
105105
ERROR_CALL_NOT_IMPLEMENTED = 0x78
106106

107107
# Handles control signals from the service control manager.
108-
Service_Ctrl_ex = Proc.new do |dwCtrlCode, _dwEventType, _lpEventData, _lpContext|
108+
Service_Ctrl_ex = proc do |dwCtrlCode, _dwEventType, _lpEventData, _lpContext|
109109
@@waiting_control_code = dwCtrlCode;
110110
return_value = NO_ERROR
111111

0 commit comments

Comments
 (0)