Skip to main content

StringPropertyWithNilDefault

The department is: StringPropertyWithNilDefault

The full name of the cop is: Chef/RedundantCode/StringPropertyWithNilDefault

Enabled by defaultSupports autocorrectionTarget Chef Version
EnabledYesAll Versions

Properties have a nil value by default so there is no need to set the default value to nil.

Examples

incorrect

property :config_file, String, default: nil
property :config_file, [String, NilClass], default: nil

correct

property :config_file, String
property :config_file, [String, NilClass]

Configurable attributes

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

Thank you for your feedback!

×









Search Results