Sha256: 6723d3092a3bfed021f0601fbf3fc9f437c0fd52a9483da2ae59726a811ef869
Contents?: true
Size: 1.52 KB
Versions: 21
Compression:
Stored size: 1.52 KB
Contents
# # Copyright:: 2019, Chef Software, Inc. # Author:: Tim Smith (<tsmith@chef.io>) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # module RuboCop module Cop module Chef module ChefModernize # Instead of using the execute resource to to run the `apt-get update` use Chef Infra Client's built-n # apt_update resource which is available in Chef Infra Client 12.7 and later. # # # bad # execute 'apt-get update' # # # good # apt_update # class ExecuteAptUpdate < Cop MSG = 'Use the apt_update resource instead of the execute resource to run an apt-get update package cache update'.freeze def_node_matcher :execute_apt_update?, <<-PATTERN (send nil? :execute (str "apt-get update")) PATTERN def on_send(node) execute_apt_update?(node) do add_offense(node, location: :expression, message: MSG, severity: :refactor) end end end end end end end
Version data entries
21 entries across 21 versions & 1 rubygems