Class: RuboCop::Cop::InSpecStyle::DeprecatedAttributes

Inherits:
RuboCop::Cop
  • Object
show all
Includes:
RangeHelp
Defined in:
lib/rubocop/cop/inspecstyle/deprecated_attributes.rb

Overview

Examples:

DeprecatedAttributes: Do not use attributes

# Attributes have been deprecated for inputs
# https://github.com/inspec/inspec/issues/3802

# bad
attribute('my_element', value: 10)

# good
input('my_element', value: 10)

Constant Summary collapse

MSG =
'Use `#input` instead of `#attribute`.'

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



27
28
29
30
# File 'lib/rubocop/cop/inspecstyle/deprecated_attributes.rb', line 27

def on_send(node)
  return unless attribute?(node)
  add_offense(node, location: range(node))
end