# Cookstyle 6.15 released with 8 new Ruby cops!

**URL:** <https://discourse.chef.io/t/cookstyle-6-15-released-with-8-new-ruby-cops/17513>\
**Category:** Chef Release Announcements\
**Created:** [August 10, 2020, 7:12pm UTC](https://discourse.chef.io/t/cookstyle-6-15-released-with-8-new-ruby-cops/17513 "2020-08-10T19:12:20Z")\
**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:** [August 10, 2020, 7:12pm UTC](https://discourse.chef.io/t/cookstyle-6-15-released-with-8-new-ruby-cops/17513/1 "2020-08-10T19:12:20Z")

</div>

Hey Everyone,

This week's Cookstyle release is out with an updated RuboCop engine and new cops for the Ruby side of your cookbook work.

### RuboCop 0.89.1

RuboCop has been updated to 0.89.1 which offers significant performance and autocorrection improvements to many Ruby cops that Cookstyle utilizes.

### New Ruby Cops Enabled

We have enabled many new built-in RuboCop cops that we believe are also useful in correcting Chef Infra cookbooks:

#### Lint/BinaryOperatorWithIdenticalOperands

The `Lint/BinaryOperatorWithIdenticalOperands` cop detects conditionals with duplicate checks. For example, `b == 0 && b == 0` which can be simplified to just `b == 0`

#### Lint/DuplicateElsifCondition

The `Lint/BinaryOperatorWithIdenticalOperands` cop detects conditions with duplicate `elsif` checks that can be removed.

#### Lint/DuplicateRescueException

The `Lint/BinaryOperatorWithIdenticalOperands` cop detects duplicate `rescue` statements in code that can be removed.

#### Lint/OutOfRangeRegexpRef

The `Lint/OutOfRangeRegexpRef` detects the use of regex captures that are outside of the range of possible capture groups within a regex statement. For example, `/(foo)bar/ =~ 'foobar'` has a single capture so `$2` is not a valid capture and will always return `nil`.

#### Style/ArrayCoercion

The `Style/ArrayCoercion` cop ensures a consistent method of coercing data types into Arrays. For example, this will autocorrect `foo = "some_string"; [foo]` into `foo = "some_string"; Array(foo)` and `[*paths]` into `Array(paths)` to make it more clear what is being done.

#### Style/BisectedAttrAccessor

The `Style/BisectedAttrAccessor` cop will detect classes that include both an `attr_reader` and `attr_writer` and combine them into a single `attr_accessor`.

#### Style/RedundantAssignment

The `Style/RedundantAssignment` cop detects methods that assign a value to a variable immediately before returning the variable. This assignment is not necessary and increases memory usage. Instead just return the value directly.

#### Style/SingleArgumentDig

The `Style/SingleArgumentDig` cop detects code that uses `.dig` to fetch a value from a Hash just one level deep. For example, this cop will autocorrect `{ key: 'value' }.dig(:key)` to just `{ key: 'value' }[:key]`

Enjoy,  
Tim
