Chef/RedundantCode/OhaiAttributeToString
The Cookstyle cops department: Chef/RedundantCode
Enabled by default | Supports autocorrection | Target Chef Version |
---|---|---|
Enabled | Yes | All Versions |
Many Ohai node attributes are already strings and don’t 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 |