Skip to main content

Chef/Modernize/CustomResourceWithAttributes

Cookstyle cops page

The Cookstyle cops department: Chef/Modernize

Enabled by defaultSupports autocorrectionTarget Chef Version
EnabledYesAll Versions

In HWRPs and LWRPs you defined attributes, but custom resources changed the name to be properties to avoid confusion with chef recipe attributes. When writing a custom resource they should be called properties even though the two are aliased.

Examples

incorrect

attribute :something, String

action :create do
  # some action code because we're in a custom resource
end

correct

property :something, String

action :create do
  # some action code because we're in a custom resource
end

Configurable attributes

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

Thank you for your feedback!

×