Skip to main content

PropertyWithNameAttribute

All Cookstyle Cops


The department is: Chef/Modernize

The full name of the cop is: Chef/Modernize/PropertyWithNameAttribute


Enabled by defaultSupports autocorrectionTarget Chef Version
EnabledYesAll Versions

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

Examples

incorrect

property :bob, String, name_attribute: true

correct

property :bob, String, name_property: true

Configurable attributes

NameDefault valueConfigurable values
Version Added5.1.0String
Include
  • **/resources/*.rb
  • **/libraries/*.rb
Array

Was this page helpful?