Chef/Style/NegatingOnlyIf
The Cookstyle cops department: Chef/Style
Enabled by default | Supports autocorrection | Target Chef Version |
---|---|---|
Enabled | Yes | All Versions |
Instead of using only_if conditionals with ! to negate the returned value, use not_if which is easier to read
Examples
incorrect
package 'legacy-sysv-deps' do
only_if { !systemd }
end
correct
package 'legacy-sysv-deps' do
not_if { systemd }
end
Configurable attributes
Name | Default value | Configurable values |
---|---|---|
Version Added | 6.2.0 | String |
Include | Array |