Class: RuboCop::Cop::Chef::Style::ImmediateNotificationTiming

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Defined in:
lib/rubocop/cop/chef/style/immediate_notification_timing.rb

Overview

Use :immediately instead of :immediate for resource notification timing.

Examples:


### incorrect

template '/etc/www/configures-apache.conf' do
  notifies :restart, 'service[apache]', :immediate
end

### correct

template '/etc/www/configures-apache.conf' do
  notifies :restart, 'service[apache]', :immediately
end

Constant Summary collapse

MSG =
'Use :immediately instead of :immediate for resource notification timing'
RESTRICT_ON_SEND =
[:notifies, :subscribes].freeze

Instance Method Summary collapse

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_send(node) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/rubocop/cop/chef/style/immediate_notification_timing.rb', line 48

def on_send(node)
  immediate_notify?(node) do |timing|
    add_offense(timing, severity: :refactor) do |corrector|
      corrector.replace(timing, ':immediately')
    end
  end
end