class RuboCop::Cop::InSpecStyle::DeprecatedAttributes

@example 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)

Constants

MSG

Public Instance Methods

on_send(node) click to toggle source
# 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

Private Instance Methods

range(node) click to toggle source
# File lib/rubocop/cop/inspecstyle/deprecated_attributes.rb, line 34
def range(node)
  # Only highlights the method 'attribute'
  range_between(node.source_range.begin_pos,
    node.source_range.begin_pos+9
  )
end