Class: RuboCop::Cop::Chef::Deprecations::CookbooksDependsOnSelf
- Extended by:
- AutoCorrector
- Includes:
- RangeHelp
- Defined in:
- lib/rubocop/cop/chef/deprecation/cb_depends_on_self.rb
Overview
Make sure a cookbook doesn’t depend on itself. This will fail on Chef Infra Client 13+
Constant Summary collapse
- MSG =
'A cookbook cannot depend on itself. This will fail on Chef Infra Client 13+'
- RESTRICT_ON_SEND =
[:name].freeze
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#on_send(node) ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/rubocop/cop/chef/deprecation/cb_depends_on_self.rb', line 43 def on_send(node) cb_name?(node) do dependencies(processed_source.ast).each do |dep| next unless dep.arguments == node.arguments add_offense(dep, severity: :refactor) do |corrector| corrector.remove(range_with_surrounding_space(range: dep.loc.expression, side: :left)) end end end end |