class RuboCop::Cop::InSpecStyle::DeprecatedAttributes1
Checks if deprecated method attribute1 is used.
@example EnforcedStyle: InSpecStyle
(default)
# Attributes have been deprecated for inputs # https://github.com/inspec/inspec/issues/3802 # bad attribute1('my_element', value: 10) # good input('my_element', value: 10)
Constants
- MSG
Public Instance Methods
autocorrect(node)
click to toggle source
# File lib/rubocop/cop/inspecstyle/deprecated_attributes1.rb, line 34 def autocorrect(node) lambda do |corrector| corrector.replace(offense_range(node), preferred_replacement) end end
on_send(node)
click to toggle source
# File lib/rubocop/cop/inspecstyle/deprecated_attributes1.rb, line 28 def on_send(node) return unless attribute1?(node) add_offense(node, location: node.loc.selector) end
Private Instance Methods
offense_range(node)
click to toggle source
# File lib/rubocop/cop/inspecstyle/deprecated_attributes1.rb, line 42 def offense_range(node) node.loc.selector end
preferred_replacement()
click to toggle source
# File lib/rubocop/cop/inspecstyle/deprecated_attributes1.rb, line 46 def preferred_replacement cop_config.fetch('PreferredReplacement') end