Skip to main content

Chef/Modernize/ConditionalUsingTest

Cookstyle cops page

The Cookstyle cops department: Chef/Modernize

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