Class: RuboCop::Cop::Chef::Deprecations::ChefShellout
- Extended by:
- AutoCorrector
- Includes:
- RangeHelp
- Defined in:
- lib/rubocop/cop/chef/deprecation/chef_shellout.rb
Overview
Don’t use the deprecated ‘Chef::ShellOut` class which was removed in Chef Infra Client 13. Use the `Mixlib::ShellOut` class instead, which behaves identically or convert to the simpler `shell_out` helper.
Constant Summary collapse
- MSG =
"Don't use the deprecated `Chef::ShellOut` class which was removed in Chef Infra Client 13. Use the `Mixlib::ShellOut` class instead, which behaves identically."
- RESTRICT_ON_SEND =
[:new, :require, :include].freeze
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#on_send(node) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/rubocop/cop/chef/deprecation/chef_shellout.rb', line 60 def on_send(node) include_shellout?(node) do add_offense(node, severity: :warning) do |corrector| corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left)) end end require_shellout?(node) do add_offense(node, severity: :warning) do |corrector| corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left)) end end shellout_new?(node) do add_offense(node, severity: :warning) do |corrector| corrector.replace(node, node.source.gsub('Chef::ShellOut', 'Mixlib::ShellOut')) end end end |