class RuboCop::Cop::Chef::Sharing::IncludeResourceExamples

Resources should include examples field to allow automated documentation. Requires Chef Infra Client 13.9 or later.

@example

#### correct
examples <<~DOC
  **Specify a global domain value**

  ```ruby
  macos_userdefaults 'full keyboard access to all controls' do
    key 'AppleKeyboardUIMode'
    value '2'
  end
  ```
DOC

Constants

MSG

Public Instance Methods

on_new_investigation() click to toggle source
# File lib/rubocop/cop/chef/sharing/include_resource_examples.rb, line 46
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(range, severity: :refactor)
end