Class: RuboCop::Cop::Chef::Deprecations::RubyBlockCreateAction
- Extended by:
- AutoCorrector
- Includes:
- RuboCop::Chef::CookbookHelpers
- Defined in:
- lib/rubocop/cop/chef/deprecation/ruby_block_create_action.rb
Overview
Use the :run action in the ruby_block resource instead of the deprecated :create action
Constant Summary collapse
- MSG =
'Use the :run action in the ruby_block resource instead of the deprecated :create action'
Instance Method Summary collapse
Methods included from RuboCop::Chef::CookbookHelpers
#match_property_in_resource?, #match_resource_type?, #method_arg_ast_to_string, #resource_block_name_if_string
Methods inherited from Base
Instance Method Details
#on_block(node) ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/rubocop/cop/chef/deprecation/ruby_block_create_action.rb', line 48 def on_block(node) match_property_in_resource?(:ruby_block, 'action', node) do |ruby_action| ruby_action.arguments.each do |action| next unless action.source == ':create' add_offense(action, severity: :warning) do |corrector| corrector.replace(action, ':run') end end end end |