Hey everyone,
Today Cookstyle 5.19 was released with 2 new Chef cops bringing the total to 160 cops! There's also a large number of important improvements and bug fixes for the existing cops. As always, please let us know if you run into issues or have suggestions for new Cookstyle cops at https://github.com/chef/cookstyle/issues/
2 New Cops
ChefRedundantCode/GroupingMetadata
The ChefRedundantCode/GroupingMetadata
cop removes the legacy grouping
metadata from the metadata.rb file. This metadata was never consumed by any Chef Infra services and does not need to be defined.
ChefStyle/OverlyComplexSupportsDependsMetadata
The ChefStyle/OverlyComplexSupportsDependsMetadata
cop cleans up overly complex methods of declaring supports
or depends
metadata via an array. This rule will detect and correct the array or each form of declaring this metadata when there are fewer than three items.
Overly complex metadata:
%w(windows apt).each |cb|
depends cb
end
Simpler form:
depends 'apt'
depends 'windows'
Other fixes and changes
- Various cops that remove legacy code no longer leave behind empty lines when autocorrecting.
-
ChefRedundantCode/LongDescriptionMetadata
now properly autocorrects whenlong_description
uses a here document (heredoc). -
ChefDeprecations/UserDeprecatedSupportsProperty
no longer fails to autocorrect when the supports hash uses Ruby 1.8 hash rocket syntax. -
ChefStyle/FileMode
now autocorrects file modes using single quotes instead of double quotes. -
ChefSharing/InvalidLicenseString
now autocorrectsUNLICENSED
toall rights reserved
. -
ChefModernize/AllowedActionsFromInitialize
no longer alerts when appending into an existing@allowed_actions
variable.
Enjoy,
Tim