Class: RuboCop::Cop::InSpec::Deprecations::AttributeDefault

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Defined in:
lib/rubocop/cop/inspec/deprecation/attribute_default.rb

Overview

The Chef InSpec inputs ‘default` option has been replaced with the `value` option.

Examples:


### incorrect
 = input('login_defs_umask', default: '077', description: 'Default umask to set in login.defs')

### correct
 = input('login_defs_umask', value: '077', description: 'Default umask to set in login.defs')

Constant Summary collapse

MSG =
'The InSpec inputs `default` option has been replaced with the `value` option.'
RESTRICT_ON_SEND =
[:attribute, :input].freeze

Instance Method Summary collapse

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_send(node) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/rubocop/cop/inspec/deprecation/attribute_default.rb', line 42

def on_send(node)
  default?(node) do |n|
    add_offense(n, severity: :warning) do |corrector|
      corrector.replace(n, 'value')
    end
  end
end