Class: RuboCop::Cop::InSpecStyle::WindowsRegistryKey

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

Overview

Examples:

EnforcedStyle: InSpecStyle (default)

# windows_registry_key has been deprecated as a resource. Use registry_key instead

Constant Summary collapse

MSG =
'Use `registry_key` instead of `windows_registry_key`. '\
'This resource will be removed in InSpec 5.'

Instance Method Summary collapse

Instance Method Details

#autocorrect(node) ⇒ Object



22
23
24
25
26
# File 'lib/rubocop/cop/inspecstyle/windows_registry_key.rb', line 22

def autocorrect(node)
  lambda do |corrector|
    corrector.replace(node.loc.selector, preferred_replacement)
  end
end

#on_send(node) ⇒ Object



17
18
19
20
# File 'lib/rubocop/cop/inspecstyle/windows_registry_key.rb', line 17

def on_send(node)
  return unless windows_registry_key?(node)
  add_offense(node, location: :selector)
end