class RuboCop::Cop::Chef::Deprecations::Ruby27KeywordArgumentWarnings

Pass options to shell_out helpers without the brackets to avoid Ruby 2.7 deprecation warnings.

@example

#### incorrect
shell_out!('hostnamectl status', { returns: [0, 1] })
shell_out('hostnamectl status', { returns: [0, 1] })

#### correct
shell_out!('hostnamectl status', returns: [0, 1])
shell_out('hostnamectl status', returns: [0, 1])

Constants

MSG
RESTRICT_ON_SEND

Public Instance Methods

on_send(node) click to toggle source
# File lib/rubocop/cop/chef/deprecation/ruby_27_keyword_argument_warnings.rb, line 44
def on_send(node)
  positional_shellout?(node) do |h|
    next unless h.braces?
    add_offense(h, message: MSG, severity: :refactor) do |corrector|
      corrector.replace(h, h.source[1..-2])
    end
  end
end