Class: RuboCop::Cop::InSpecStyle::Apache

Inherits:
RuboCop::Cop show all
Defined in:
lib/rubocop/cop/inspecstyle/apache.rb

Overview

Do not use apache

Examples:

EnforcedStyle: InSpecStyle (default)

# apache has been deprecated
# 'https://github.com/inspec/inspec/issues/3131'
# Since there are multiples replacements autocorrect is not supported.

# bad
apache

# good
azurerm_virtual_machine # use a specific resource pack resource

Constant Summary collapse

MSG =
'Use a `apache_conf` instead of `#apache`. '\
'This resource will be removed in InSpec 5.'

Instance Method Summary collapse

Instance Method Details

#autocorrect(node) ⇒ Object



39
40
41
42
43
# File 'lib/rubocop/cop/inspecstyle/apache.rb', line 39

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

#on_send(node) ⇒ Object



33
34
35
36
37
# File 'lib/rubocop/cop/inspecstyle/apache.rb', line 33

def on_send(node)
  return unless apache?(node)

  add_offense(node, location: :selector)
end