Class: RuboCop::Cop::Chef::ChefModernize::IncludingAptDefaultRecipe

Inherits:
RuboCop::Cop
  • Object
show all
Defined in:
lib/rubocop/cop/chef/modernize/apt_default_recipe.rb

Overview

Don’t include the apt default recipe to update apt’s package cache when you can use the apt_update resource built into Chef Infra Client 12.7 and later.

Examples:


# bad
include_recipe 'apt::default'
include_recipe 'apt'

# good
apt_update

Constant Summary collapse

MSG =
'Do not include the Apt default recipe to update package cache. Instead use the apt_update resource, which is built into Chef Infra Client 12.7 and later.'.freeze

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



40
41
42
43
44
# File 'lib/rubocop/cop/chef/modernize/apt_default_recipe.rb', line 40

def on_send(node)
  apt_recipe_usage?(node) do
    add_offense(node, location: :expression, message: MSG, severity: :refactor)
  end
end