Class: RuboCop::Cop::Chef::Deprecations::UsesChefRESTHelpers

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

Overview

The ‘Chef::REST` class was removed in Chef Infra Client 13.

Examples:


### incorrect
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"
RESTRICT_ON_SEND =
[:require].freeze

Instance Method Summary collapse

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_const(node) ⇒ Object



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

def on_const(node)
  rest_const?(node) do
    add_offense(node, severity: :warning)
  end
end

#on_send(node) ⇒ Object



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

def on_send(node)
  require_rest?(node) do
    add_offense(node, severity: :warning)
  end
end