Class: RuboCop::Cop::Chef::Correctness::LazyInResourceGuard
- Extended by:
 - AutoCorrector
 
- Defined in:
 - lib/rubocop/cop/chef/correctness/lazy_in_resource_guard.rb
 
Overview
Using ‘lazy {}` within a resource guard (not_if/only_if) will cause failures and is unnecessary as resource guards are always lazily evaluated.
Constant Summary collapse
- MSG =
 'Using `lazy {}` within a resource guard (not_if/only_if) will cause failures and is unnecessary as resource guards are always lazily evaluated.'
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#on_block(node) ⇒ Object
      56 57 58 59 60 61 62  | 
    
      # File 'lib/rubocop/cop/chef/correctness/lazy_in_resource_guard.rb', line 56 def on_block(node) lazy_in_guard?(node) do |type, code| add_offense(node, severity: :refactor) do |corrector| corrector.replace(node, "#{type} { #{code.source} }") end end end  |