Class: RuboCop::Cop::Chef::Modernize::IncludingWindowsDefaultRecipe

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

Overview

Don’t include the windows default recipe that is either full of gem install that are part of the Chef Infra Client, or empty (depends on version).

Examples:


### incorrect
include_recipe 'windows::default'
include_recipe 'windows'

Constant Summary collapse

MSG =
'Do not include the Windows default recipe, which only installs win32 gems already included in Chef Infra Client'
RESTRICT_ON_SEND =
[:include_recipe].freeze

Instance Method Summary collapse

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_send(node) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/rubocop/cop/chef/modernize/windows_default_recipe.rb', line 41

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