Skip to main content

Chef/Modernize/UseRequireRelative

Cookstyle cops page

The Cookstyle cops department: Chef/Modernize

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

    Thank you for your feedback!

    ×











    Search Results