Class: RuboCop::Cop::Chef::Correctness::InvalidDefaultAction

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/chef/correctness/invalid_default_action.rb

Overview

Default actions in resources should be symbols or an array of symbols.

Examples:


### incorrect
default_action 'create'

### correct
default_action :create

Constant Summary collapse

MSG =
'Default actions in resources should be symbols or an array of symbols.'
RESTRICT_ON_SEND =
[:default_action].freeze

Instance Method Summary collapse

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_send(node) ⇒ Object



38
39
40
41
42
43
# File 'lib/rubocop/cop/chef/correctness/invalid_default_action.rb', line 38

def on_send(node)
  default_action?(node) do |match|
    return if %i(send sym array).include?(match.type)
    add_offense(node, severity: :refactor)
  end
end