Class: RuboCop::Cop::Chef::Modernize::DependsOnWindowsFirewallCookbook

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector, TargetChefVersion
Includes:
RangeHelp
Defined in:
lib/rubocop/cop/chef/modernize/depends_windows_firewall_cookbook.rb

Overview

Don’t depend on the windows_firewall cookbook made obsolete by Chef Infra Client 14.7. The windows_firewall resource is now included in Chef Infra Client itself.

Examples:


### incorrect
depends 'windows_firewall'

Constant Summary collapse

MSG =
"Don't depend on the windows_firewall cookbook made obsolete by Chef Infra Client 14.7. The windows_firewall resource is now included in Chef Infra Client itself."
RESTRICT_ON_SEND =
[:depends].freeze

Instance Method Summary collapse

Methods included from TargetChefVersion

minimum_target_chef_version, required_minimum_chef_version, support_target_chef_version?

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_send(node) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/rubocop/cop/chef/modernize/depends_windows_firewall_cookbook.rb', line 43

def on_send(node)
  legacy_depends?(node) do
    add_offense(node, severity: :refactor) do |corrector|
      corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left))
    end
  end
end