Skip to main content

Chef/RedundantCode/StringPropertyWithNilDefault

Cookstyle cops page

The Cookstyle cops department: Chef/RedundantCode

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