Skip to main content

PropertyWithoutType

The department is: PropertyWithoutType

The full name of the cop is: Chef/Correctness/PropertyWithoutType

Enabled by defaultSupports autocorrectionTarget Chef Version
EnabledNoAll Versions

Resource properties or attributes should always define a type to help users understand the correct allowed values.

Examples

incorrect

property :size, regex: /^\d+[KMGTP]$/
attribute :size, regex: /^\d+[KMGTP]$/

correct

property :size, String, regex: /^\d+[KMGTP]$/
attribute :size, kind_of: String, regex: /^\d+[KMGTP]$/

Configurable attributes

NameDefault valueConfigurable values
Version Added6.18.0String
Include
  • **/libraries/*.rb
  • **/resources/*.rb
Array

Was this page helpful?

×









Search Results