RespondToCompileTime

All Cookstyle Cops


The department is: Chef/Modernize

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


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

There is no need to check if the chef_gem resource supports compile_time as Chef Infra Client 12.1 and later support the compile_time property.

Examples

incorrect

chef_gem 'ultradns-sdk' do
  compile_time true if Chef::Resource::ChefGem.method_defined?(:compile_time)
  action :nothing
end

chef_gem 'ultradns-sdk' do
  compile_time true if Chef::Resource::ChefGem.instance_methods(false).include?(:compile_time)
  action :nothing
end

chef_gem 'ultradns-sdk' do
  compile_time true if respond_to?(:compile_time)
  action :nothing
end

correct

chef_gem 'ultradns-sdk' do
  compile_time true
  action :nothing
end

Configurable attributes

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

© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs.chef.io/workstation/cookstyle/chef_modernize_respondtocompiletime/