Skip to main content

Chef/Correctness/IncorrectLibraryInjection

Cookstyle cops page

The Cookstyle cops department: Chef/Correctness

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