Cookstyle 6.17 released with 4 new Chef cops!

Hey everyone!

I hope everyone is having an excellent Friday and to make things a bit nicer we shipped a new release Cookstyle to help identify more deprecations between Chef Infra Client 12 and 13:

4 New Cops

ChefDeprecations/ChefShellout

The ChefDeprecations/ChefShellout cop detects the use of the Chef::ShellOut class, which was removed in Chef Infra Client 13. It will autocorrect all occurrences to instead use Mixlib::ShellOut, which is a drop-in replacement.

Enabled by default: True

Autocorrects: Yes

ChefDeprecations/ExecutePathProperty

The ChefDeprecations/ExecutePathProperty cop detects execute resources that use the path property, which was removed in Chef Infra Client 13. To set a path for use when executing, you should instead set the PATH via the environment property.

Enabled by default: True

Autocorrects: No

ChefDeprecations/ExecuteRelativeCreatesWithoutCwd

The ChefDeprecations/ExecuteRelativeCreatesWithoutCwd cop detects the usage of the execute resource with a relative path in the creates property and with no cwd property present. This condition will fail in Chef Infra Client 13 or later, and it never would have actually worked, so it was always failing code. You should either provide an absolute path to the creates property, or use a relative path with creates and specify the working directory with cwd.

Enabled by default: True

Autocorrects: No

ChefDeprecations/WindowsPackageInstallerTypeString

The ChefDeprecations/WindowsPackageInstallerTypeString cop detects the usage of the windows_package resource with a installer_type property value that is a String. In Chef Infra Client 13 or later, this property value must be a Symbol.

Enabled by default: True

Autocorrects: Yes

Other Improvements

  • The ChefDeprecations/DeprecatedPlatformMethods cop now detects the usage of Chef::Platform.set, which was removed in Chef Infra Client 13.
  • Several minor performance and memory usage improvements were made to speed up Cookstyle scans.
  • An error was resolved that would occur when using Cookstyle with the rubocop-ast gem, version 0.4.0 or later.

Enjoy,
Tim