chef / cookstyle

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.
Apache License 2.0
107 stars 54 forks source link

Chef/Modernize/CronDFileOrTemplate Improvements #944

Closed yacn closed 2 years ago

yacn commented 2 years ago

Description

Related Issue

https://github.com/chef/cookstyle/issues/943

Types of changes

Checklist:

tas50 commented 2 years ago

This is a great improvement. Thanks

tas50 commented 2 years ago

@yacn This PR is a bit too aggressive on finding issues. You probably want to add a doesn't detect spec for something like this:

template '/etc/mysql/cakephp-grants.sql' do
  path '/etc/mysql/cakephp-grants.sql'
  source 'grants.sql.erb'
  owner 'root'
  group 'root'
  mode '0600'
  variables(
    user: node['cakephp']['db']['user'],
    password: node['cakephp']['db']['password'],
    database: node['cakephp']['db']['database']
  )
  notifies :run, 'execute[mysql-install-cakephp-privileges]', :immediately
end
tas50 commented 2 years ago

@yacn Let me know if you see any issue with https://github.com/chef/cookstyle/pull/945

yacn commented 2 years ago

This PR is a bit too aggressive on finding issues. You probably want to add a doesn't detect spec for something like this:

Great catch!