Skip to main content

IncorrectLibraryInjection

All Cookstyle Cops


The department is: Chef/Correctness

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
Exclude
  • **/metadata.rb
  • **/Berksfile
Array

Was this page helpful?









Search Results