Chef/Modernize/SetOrReturnInResources
The Cookstyle cops department: Chef/Modernize
Enabled by default | Supports autocorrection | Target Chef Version |
---|---|---|
Enabled | No | All Versions |
set_or_return within a method should not be used to define property in a resource. Instead use the property method which properly validates and defines properties in a way that works with reporting and documentation functionality in Chef Infra Client
Examples
incorrect
def severity(arg = nil)
set_or_return(
:severity, arg,
:kind_of => String,
:default => nil
)
end
correct
property :severity, String
Configurable attributes
Name | Default value | Configurable values |
---|---|---|
Version Added | 5.2.0 | String |
Include |
| Array |