Cookstyle 5.18 released with 2 new Chef cops!

Hey folks,

After a short holiday break, we're back with a new release of Cookstyle. This new version adds 2 new cops and improves detection/autocorrection in existing cops.

2 New Cops


The ChefModernize/ResourceForcingCompileTime cop detects hostname, build_essential, chef_gem, and ohai_hint resources that are being set to run at compile-time by forcing an action on the resource block. These resources include compile-time properties which should be set to force the resources to run at compile-time.


The ChefModernize/ExecuteSysctl detects the usage of execute to load sysctl values. Chef Infra Client 14.0+ includes the sysctl resource which should be used to idempotently add or remove sysctl values without the need for chaining file and execute resources.

Other fixes and changes

  • The vendor and files directories in cookbooks are now better excluded when running cookstyle against a mono-repo or other collection of multiple cookbooks.
  • The ChefRedundantCode/PropertyWithRequiredAndDefault and ChefStyle/TrueClassFalseClassResourceProperties cops now check resource attributes in addition to properties.
  • The ChefRedundantCode/PropertyWithRequiredAndDefault cop now supports autocorrection by removing unnecessary default values from the property.