Skip to main content

ConditionalUsingTest

The department is: ConditionalUsingTest

The full name of the cop is: Chef/Modernize/ConditionalUsingTest

Enabled by defaultSupports autocorrectionTarget Chef Version
EnabledYesAll Versions

Use ::File.exist?(’/foo/bar’) instead of the slower ’test -f /foo/bar’ which requires shelling out

Examples

incorrect

only_if 'test -f /bin/foo'

correct

only_if { ::File.exist?('bin/foo') }

Configurable attributes

NameDefault valueConfigurable values
Version Added6.11.0String
Include
    Array

    Thank you for your feedback!

    ×









    Search Results