Chef/Modernize/ResourceNameFromInitialize
The Cookstyle cops department: Chef/Modernize
| Enabled by default | Supports autocorrection | Target Chef Version |
|---|---|---|
| Enabled | Yes | All Versions |
The resource name can now be specified using the resource_name helper instead of using the @resource_name variable in the resource provider initialize method. In general we recommend against writing HWRPs, but if HWRPs are necessary you should utilize as much of the resource DSL as possible.
Examples
# bad
def initialize(*args)
super
@resource_name = :foo
end
# good
resource_name :foo
Configurable attributes
| Name | Default value | Configurable values |
|---|---|---|
| Version Added | 5.10.0 | String |
| Include |
| Array |