class RuboCop::Cop::Chef::Deprecations::UsesRunCommandHelper

Use ‘shell_out!’ instead of the legacy ‘run_command’ or ‘run_command_with_systems_locale’ helpers for shelling out. The run_command helper was removed in Chef Infra Client 13.

@example

#### incorrect
require 'chef/mixin/command'
include Chef::Mixin::Command

run_command('/bin/foo')
run_command_with_systems_locale('/bin/foo')

#### correct
shell_out!('/bin/foo')

Constants

MSG
RESTRICT_ON_SEND

Public Instance Methods

on_send(node) click to toggle source
# File lib/rubocop/cop/chef/deprecation/run_command_helper.rb, line 46
def on_send(node)
  calls_run_command?(node) do
    add_offense(node, severity: :warning) unless defines_run_command?(processed_source.ast)
  end

  require_mixin_command?(node) do
    add_offense(node, severity: :warning)
  end

  include_mixin_command?(node) do
    add_offense(node, severity: :warning)
  end
end