lib/rubocop/cop/chef/sharing/include_resource_examples.rb in cookstyle-6.15.9 vs lib/rubocop/cop/chef/sharing/include_resource_examples.rb in cookstyle-6.16.4

- old
+ new

@@ -33,24 +33,24 @@ # value '2' # end # ``` # DOC # - class IncludeResourceExamples < Cop + class IncludeResourceExamples < Base include RangeHelp extend TargetChefVersion minimum_target_chef_version '13.9' MSG = 'Resources should include examples field to allow automated documentation. Requires Chef Infra Client 13.9 or later.' - def investigate(processed_source) - return if processed_source.blank? + def on_new_investigation + return if processed_source.blank? || resource_examples(processed_source.ast).any? # Using range similar to RuboCop::Cop::Naming::Filename (file_name.rb) range = source_range(processed_source.buffer, 1, 0) - add_offense(nil, location: range, message: MSG, severity: :refactor) unless resource_examples(processed_source.ast).any? + add_offense(range, message: MSG, severity: :refactor) end def_node_search :resource_examples, '(send nil? :examples dstr ...)' end end \ No newline at end of file