Class: RuboCop::Cop::Chef::ChefDeprecations::UsesChefRESTHelpers

Inherits:
RuboCop::Cop
  • Object
show all
Defined in:
lib/rubocop/cop/chef/deprecation/chef_rest.rb

Overview

Chef::REST was removed in Chef Infra Client 13.

Examples:


# bad
require 'chef/rest'
Chef::REST::RESTRequest.new(:GET, FOO, nil).call

Constant Summary collapse

MSG =
"Don't use the helpers in Chef::REST which were removed in Chef Infra Client 13".freeze

Instance Method Summary collapse

Instance Method Details

#on_const(node) ⇒ Object



47
48
49
50
51
# File 'lib/rubocop/cop/chef/deprecation/chef_rest.rb', line 47

def on_const(node)
  rest_const?(node) do
    add_offense(node, location: :expression, message: MSG, severity: :refactor)
  end
end

#on_send(node) ⇒ Object



41
42
43
44
45
# File 'lib/rubocop/cop/chef/deprecation/chef_rest.rb', line 41

def on_send(node)
  require_rest?(node) do
    add_offense(node, location: :expression, message: MSG, severity: :refactor)
  end
end