Class: RuboCop::Cop::Chef::Correctness::ResourceWithNoneAction
- Extended by:
- AutoCorrector
- Includes:
- RuboCop::Chef::CookbookHelpers
- Defined in:
- lib/rubocop/cop/chef/correctness/resource_with_none_action.rb
Overview
The :nothing action is often typo’d as :none
Constant Summary collapse
- MSG =
'Resource uses the nonexistent :none action instead of the :nothing 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
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rubocop/cop/chef/correctness/resource_with_none_action.rb', line 42 def on_block(node) match_property_in_resource?(nil, 'action', node) do |action_node| action_node.arguments.each do |action| next unless action.source == ':none' add_offense(action, severity: :refactor) do |corrector| corrector.replace(action, ':nothing') end end end end |