Class: RuboCop::Cop::Chef::Modernize::WhyRunSupportedTrue

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector, TargetChefVersion
Includes:
RangeHelp
Defined in:
lib/rubocop/cop/chef/modernize/whyrun_supported_true.rb

Overview

whyrun_supported? no longer needs to be set to true as that is the default in Chef Infra Client 13+

Examples:


### incorrect
def whyrun_supported?
 true
end

Constant Summary collapse

MSG =
'whyrun_supported? no longer needs to be set to true as it is the default in Chef Infra Client 13+'

Instance Method Summary collapse

Methods included from TargetChefVersion

minimum_target_chef_version, required_minimum_chef_version, support_target_chef_version?

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_def(node) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/rubocop/cop/chef/modernize/whyrun_supported_true.rb', line 47

def on_def(node)
  whyrun_true?(node) do
    add_offense(node, severity: :refactor) do |corrector|
      corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left))
    end
  end
end