class RuboCop::Cop::Chef::Modernize::Definitions

In 2016 with Chef Infra Client 12.5 Custom Resources were introduced as a way of writing reusable resource code that could be shipped in cookbooks. Custom Resources offer many advantages of legacy Definitions including unit testing with ChefSpec, input validation, actions, common properties like not_if/only_if, and resource reporting.

Constants

MSG

Public Instance Methods

on_block(node) click to toggle source
# File lib/rubocop/cop/chef/modernize/definitions.rb, line 29
def on_block(node)
  add_offense(node, message: MSG, severity: :refactor) if node.respond_to?(:method_name) && node.method_name == :define
end