# Cookstyle 7.1 released with 2 new Chef cops!

**URL:** <https://discourse.chef.io/t/cookstyle-7-1-released-with-2-new-chef-cops/17915>\
**Category:** Chef Release Announcements\
**Created:** [November 5, 2020, 11:53pm UTC](https://discourse.chef.io/t/cookstyle-7-1-released-with-2-new-chef-cops/17915 "2020-11-05T23:53:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tas50](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/tas50/32/941_2.png) [@tas50](https://discourse.chef.io/u/tas50)\
**Post date:** [November 5, 2020, 11:53pm UTC](https://discourse.chef.io/t/cookstyle-7-1-released-with-2-new-chef-cops/17915/1 "2020-11-05T23:53:45Z")

</div>

Hey folks,

It's that time of the week again. Time for new a new release of Cookstyle with more cleanup of legacy cookbooks. This time we've added 2 new Chef Infra cops, 1 new Ruby cop, and improved many of the existing cops.

### RuboCop 1.2.0

RuboCop has been updated to 1.2.0, which includes bug fixes and improvements for many of RuboCop's built in Ruby cops.

### 2 New Chef Infra Cops

#### Chef/Deprecations/FoodcriticTesting

The `Chef/Deprecations/FoodcriticTesting` cop detects cookbooks with a Gemfile that requires Foodcritic or any code, such as a Rakefile/Guardfile, that requires the Foodcritic gem. Foodcritic is no longer supported and has been significantly eclipsed in functionality by Cookstyle. Any existing Rakefile or Guardfile tests for Foodcritic should be updated to use Cookstyle instead.

`Enabled by default`: True

`Autocorrects`: False

#### Chef/Deprecations/LibrarianChefSpec

The `Chef/Deprecations/LibrarianChefSpec` cop detects ChefSpec tests that require the legacy `chefspec/librarian` library. Librarian Chef is no longer supported and users should migrate to Berkshelf or Policyfiles.

`Enabled by default`: True

`Autocorrects`: True

### 1 New Ruby Cop

The `Style/CollectionCompact` cop detects code that removes `nil` values from Hashes or Arrays using a Ruby block when this can be done with the `compact` method instead.

`Enabled by default`: True

`Autocorrects`: True

`Examples:`

Overly complex nil removals:

```ruby
array.reject { |e| e.nil? }
array.select { |e| !e.nil? }

```

Simpler nil removal:

```ruby
array.compact

```

### Other Improvements

- The `Chef/Modernize/UseMultipackageInstalls` cop no longer fails if the `when` condition uses a Regex instead of a String.
- The `Chef/Modernize/UseMultipackageInstalls` cop detects overly complex arrays of package resources if the `when` condition contains code other than the package resources.

Enjoy,  
Tim
