Skip to main content

RespondToInMetadata

The department is: RespondToInMetadata

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

Enabled by default Supports autocorrection Target Chef Version
Enabled Yes 12.15+

It is not longer necessary respond_to?(:foo) or defined?(foo) in metadata. This was used to support new metadata methods in Chef 11 and early versions of Chef 12.

Examples

incorrect

chef_version '>= 13' if respond_to?(:chef_version)
chef_version '>= 13' if defined?(chef_version)
chef_version '>= 13' unless defined?(Ridley::Chef::Cookbook::Metadata)
if defined(chef_version)
  chef_version '>= 13'
end

correct

chef_version '>= 13'

Configurable attributes

Name Default value Configurable values
Version Added 5.2.0 String
Include
  • **/metadata.rb
Array

Was this page helpful?

×









Search Results