Class: RuboCop::Cop::Chef::Sharing::IncludePropertyDescriptions

Inherits:
Base
  • Object
show all
Extended by:
TargetChefVersion
Defined in:
lib/rubocop/cop/chef/sharing/include_property_descriptions.rb

Overview

Resource properties should include description fields to allow automated documentation. Requires Chef Infra Client 13.9 or later.

Examples:


### incorrect
property :foo, String

### correct
property :foo, String, description: "Set the important thing to..."

Constant Summary collapse

MSG =
'Resource properties should include description fields to allow automated documentation. Requires Chef Infra Client 13.9 or later.'
RESTRICT_ON_SEND =
[:property].freeze

Instance Method Summary collapse

Methods included from TargetChefVersion

minimum_target_chef_version, required_minimum_chef_version, support_target_chef_version?

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_send(node) ⇒ Object



46
47
48
49
50
# File 'lib/rubocop/cop/chef/sharing/include_property_descriptions.rb', line 46

def on_send(node)
  property?(node) do
    add_offense(node, severity: :refactor) unless description_hash?(node)
  end
end