class RuboCop::Cop::Chef::Modernize::ShellOutHelper

Use the built-in ‘shell_out` helper available in Chef Infra Client 12.11+ instead of calling `Mixlib::ShellOut.new(’foo’).run_command`.

@example

#### incorrect
Mixlib::ShellOut.new('foo').run_command

#### correct
shell_out('foo')

Constants

MSG
RESTRICT_ON_SEND

Public Instance Methods

on_send(node) click to toggle source
# File lib/rubocop/cop/chef/modernize/shell_out_helper.rb, line 49
def on_send(node)
  mixlib_shellout_run_cmd?(node) do |cmd|
    add_offense(node, severity: :refactor) do |corrector|
      corrector.replace(node, "shell_out(#{cmd.source})")
    end
  end
end