Class: RuboCop::Cop::Chef::Modernize::UnnecessaryMixlibShelloutRequire

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Includes:
RangeHelp
Defined in:
lib/rubocop/cop/chef/modernize/unnecessary_mixlib_shellout_require.rb

Overview

Chef Infra Client 12.4+ includes mixlib/shellout automatically in resources and providers.

Examples:


### incorrect
require 'mixlib/shellout'

Constant Summary collapse

MSG =
'Chef Infra Client 12.4+ includes mixlib/shellout automatically in resources and providers.'
RESTRICT_ON_SEND =
[:require].freeze

Instance Method Summary collapse

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_send(node) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/rubocop/cop/chef/modernize/unnecessary_mixlib_shellout_require.rb', line 40

def on_send(node)
  require_mixlibshellout?(node) do
    add_offense(node, severity: :refactor) do |corrector|
      corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left))
    end
  end
end