class RuboCop::Cop::Chef::Modernize::PropertyWithNameAttribute

When using properties in a custom resource you should use name_property not the legacy name_attribute from the days of attributes

@example

#### incorrect
property :bob, String, name_attribute: true

#### correct
property :bob, String, name_property: true

Constants

MSG
RESTRICT_ON_SEND

Public Instance Methods

on_send(node) click to toggle source
# File lib/rubocop/cop/chef/modernize/property_with_name_attribute.rb, line 45
def on_send(node)
  property_with_name_attribute?(node) do |name_attribute|
    add_offense(node, severity: :refactor) do |corrector|
      corrector.replace(name_attribute, 'name_property: true')
    end
  end
end