Class: RuboCop::Cop::Chef::Ruby::LegacyPowershellOutMethods

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/chefstyle/ruby/legacy_powershell_out_methods.rb

Overview

Use powershell_exec!/powershell_exec instead of powershell_out!/powershell_out. The new methods don’t spawn 2 shells per shellout and instead use .NET bindings to call PS directly.

Constant Summary collapse

MSG =
'Use powershell_exec!/powershell_exec instead of the slower legacy powershell_out!/powershell_out methods.'
RESTRICT_ON_SEND =
%i(powershell_out! powershell_out).freeze

Instance Method Summary collapse

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_send(node) ⇒ Object



29
30
31
# File 'lib/rubocop/cop/chefstyle/ruby/legacy_powershell_out_methods.rb', line 29

def on_send(node)
  add_offense(node, message: MSG, severity: :refactor)
end