Skip to main content

IncorrectLibraryInjection

The department is: IncorrectLibraryInjection

The full name of the cop is: Chef/Correctness/IncorrectLibraryInjection

Enabled by defaultSupports autocorrectionTarget Chef Version
EnabledYesAll Versions

Libraries should be injected into the Chef::DSL::Recipe class and not Chef::Recipe or Chef::Provider classes directly.

Examples

incorrect

::Chef::Recipe.send(:include, Filebeat::Helpers)
::Chef::Provider.send(:include, Filebeat::Helpers)
::Chef::Recipe.include Filebeat::Helpers
::Chef::Provider.include Filebeat::Helpers

correct

::Chef::DSL::Recipe.send(:include, Filebeat::Helpers) # covers previous Recipe & Provider classes

Configurable attributes

NameDefault valueConfigurable values
Version Added5.10.0String
Include
    Array

    Thank you for your feedback!

    ×









    Search Results