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

Name Default value Configurable values
Version Added 5.10.0 String
Exclude
  • **/metadata.rb
  • **/Berksfile
Array

Was this page helpful?

×








Search Results