Skip to main content

UseRequireRelative

The department is: UseRequireRelative

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

Enabled by default Supports autocorrection Target Chef Version
Enabled Yes All 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

Name Default value Configurable values
Version Added 5.22.0 String
Include
Array

Was this page helpful?

×









Search Results