cookstyle
cookstyle copied to clipboard
A linting tool that helps you to write better Chef Infra cookbooks and InSpec profiles by detecting and automatically correcting style, syntax, and logic mistakes in your code.
# Version: Chef Workstation 22.2.807 Cookstyle 7.32.0 # Environment: Debian 11 # Scenario: We use a _cookbook_file_ resource to process a file in _/etc/cron.daily_ # Steps to Reproduce: Add the...
/etc/cron.deny is matching with the `Chef/Modernize/CronDFileOrTemplate` cop. Example: ```ruby file '/etc/cron.deny' do action :delete end ```
```ruby unified_mode true if respond_to?(:unified_mode) ``` That isn't a coherent thing to ever want to do, since you get `unified_mode true` behavior on newer chef-client and `unified_mode false` behavior on...
Detect deps on chef-sugar cookbook, deps on chef-sugar gem, and `include_recipe 'chef-sugar'`
``` execute 'execute-scheduled-karaf-restart' do command 'rm -f /tmp/karaf-restart' action :run notifies :stop, 'service[karaf-deploy-stop]', :immediately # notifies cache folders deletion $karaf_cache.each do |cache_folder| notifies :delete, "directory[#{cache_folder}]", :immediately end notifies :start, 'service[karaf]',...
### What category of cop is this?: Please try to select as few as possible. - [ ] ChefDeprecations - A cop that alerts on a deprecation in the Chef...
### What category of cop is this?: Please try to select as few as possible. - [ ] Chef/Deprecations - A cop that alerts on a deprecation in the Chef...
### What category of cop is this?: Please try to select as few as possible. - [ ] Chef/Deprecations - A cop that alerts on a deprecation in the Chef...
# Version: 7.24.1 # Environment: N/A # Steps to Reproduce: ```ruby cmd = Mixlib::ShellOut.new("#{nginx_binary} -t -c #{new_resource.config_file}") cmd.run_command.error! ``` # Expected Result: ```ruby shell_out!("#{nginx_binary} -t -c #{new_resource.config_file}") ``` # Actual...
When someone does this ```ruby file tokenpath do owner new_resource.owner group new_resource.group mode '644' content authz.file_content action :nothing end.run_action(:create) ``` We should autocorrect to: ```ruby file tokenpath do owner new_resource.owner...