Class: RuboCop::Cop::Chef::Deprecations::PolicyfileCommunitySource

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

Overview

The Policyfile source of ‘:community` has been replaced with `:supermarket`

Examples:


### incorrect
default_source :community

### correct
default_source :supermarket

Constant Summary collapse

MSG =
'The Policyfile source of `:community` has been replaced with `:supermarket`.'
RESTRICT_ON_SEND =
[:default_source].freeze

Instance Method Summary collapse

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_send(node) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/rubocop/cop/chef/deprecation/policyfile_community_source.rb', line 42

def on_send(node)
  community_source?(node) do
    add_offense(node, severity: :warning) do |corrector|
      corrector.replace(node, 'default_source :supermarket')
    end
  end
end