Skip to main content


The department is: NamePropertyWithDefaultValue

The full name of the cop is: Chef/Deprecations/NamePropertyWithDefaultValue

Enabled by defaultSupports autocorrectionTarget Chef Version
EnabledYesAll Versions

A resource property (or attribute) cannot be marked as a name_property (or name_attribute) and also have a default value. The name property is a special property that is derived from the name of the resource block in and thus always has a value passed to the resource. For example if you define my_resource 'foo' in recipe, then the name property of my_resource will automatically be set to foo. Setting a property to be both a name_property and have a default value will cause Chef Infra Client failures in 13.0 and later releases.



property :config_file, String, default: 'foo', name_property: true
attribute :config_file, String, default: 'foo', name_attribute: true


property :config_file, String, name_property: true
attribute :config_file, String, name_attribute: true

Configurable attributes

NameDefault valueConfigurable values
Version Added5.7.0String
  • **/libraries/*.rb
  • **/resources/*.rb

Was this page helpful?


Search Results