Class: RuboCop::Cop::Chef::Modernize::ZipfileResource

Inherits:
Base
  • Object
show all
Extended by:
TargetChefVersion
Includes:
RuboCop::Chef::CookbookHelpers
Defined in:
lib/rubocop/cop/chef/modernize/zipfile_resource.rb

Overview

Use the archive_file resource built into Chef Infra Client 15+ instead of the zipfile resource from the zipfile cookbook.

Examples:


### incorrect
zipfile "C:\file.zip" do
  path 'C:\expand_here'
end

Constant Summary collapse

MSG =
'Use the archive_file resource built into Chef Infra Client 15+ instead of the zipfile resource from the zipfile cookbook.'
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 included from RuboCop::Chef::CookbookHelpers

#match_property_in_resource?, #match_resource_type?, #method_arg_ast_to_string, #resource_block_name_if_string

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_block(node) ⇒ Object



50
51
52
53
54
# File 'lib/rubocop/cop/chef/modernize/zipfile_resource.rb', line 50

def on_block(node)
  match_resource_type?(:zipfile, node) do
    add_offense(node, severity: :refactor)
  end
end

#on_send(node) ⇒ Object



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

def on_send(node)
  depends_zipfile?(node) do
    add_offense(node, severity: :refactor)
  end
end