OhaiAttributeToString
The department is: OhaiAttributeToString
The full name of the cop is: Chef/RedundantCode/OhaiAttributeToString
Enabled by default | Supports autocorrection | Target Chef Version |
---|---|---|
Enabled | Yes | All Versions |
Many Ohai node attributes are already strings and do not need to be cast to strings again
Examples
incorrect
node['platform'].to_s
node['platform_family'].to_s
node['platform_version'].to_s
node['fqdn'].to_s
node['hostname'].to_s
node['os'].to_s
node['name'].to_s
correct
node['platform']
node['platform_family']
node['platform_version']
node['fqdn']
node['hostname']
node['os']
node['name']
Configurable attributes
Name | Default value | Configurable values |
---|---|---|
Version Added | 6.10.0 | String |
Include | Array |
Was this page helpful?