Skip to main content

UseRequireRelative

The department is: UseRequireRelative

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

Enabled by defaultSupports autocorrectionTarget Chef Version
EnabledYesAll Versions

Instead of using require with a File.expand_path and FILE use the simpler require_relative method.

Examples

incorrect

require File.expand_path('../../libraries/helpers', __FILE__)

correct

require_relative '../libraries/helpers'

Configurable attributes

NameDefault valueConfigurable values
Version Added5.22.0String
Include
    Array

    Was this page helpful?

    ×









    Search Results