class RuboCop::Cop::Chef::Correctness::ChefApplicationFatal

Use `raise` to force Chef Infra Client to fail instead of using `Chef::Application.fatal`, which masks the full stack trace of the failure and makes debugging difficult.

@example

#### incorrect
Chef::Application.fatal!('Something horrible happened!')

#### correct
raise "Something horrible happened!"

Constants

MSG
RESTRICT_ON_SEND

Public Instance Methods

on_send(node) click to toggle source
# File lib/rubocop/cop/chef/correctness/chef_application_fatal.rb, line 45
def on_send(node)
  application_fatal?(node) do |val|
    add_offense(node, message: MSG, severity: :refactor) do |corrector|
      corrector.replace(node, "raise(#{val.source})")
    end
  end
end