diff --git a/CHANGELOG.md b/CHANGELOG.md index 2185b08589f..ce853430331 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ * [#8785](https://github.com/rubocop-hq/rubocop/pull/8785): Update TargetRubyVersion 2.8 to 3.0 (experimental). ([@koic][]) * [#8650](https://github.com/rubocop-hq/rubocop/issues/8650): Faster find of hidden files in `TargetFinder` class which improves rubocop initial startup speed. ([@tleish][]) +* [#8783](https://github.com/rubocop-hq/rubocop/pull/8783): Disable `Style/ArrayCoercion` cop by default. ([@koic][]) ## 0.91.1 (2020-09-23) diff --git a/config/default.yml b/config/default.yml index 0d7b46acc3a..aabcc34890a 100644 --- a/config/default.yml +++ b/config/default.yml @@ -2463,7 +2463,7 @@ Style/ArrayCoercion: with a variable you want to treat as an Array, but you're not certain it's an array. StyleGuide: '#array-coercion' Safe: false - Enabled: 'pending' + Enabled: false VersionAdded: '0.88' Style/ArrayJoin: diff --git a/docs/modules/ROOT/pages/cops_style.adoc b/docs/modules/ROOT/pages/cops_style.adoc index e1ea36e09d0..809b549461e 100644 --- a/docs/modules/ROOT/pages/cops_style.adoc +++ b/docs/modules/ROOT/pages/cops_style.adoc @@ -295,7 +295,7 @@ end |=== | Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged -| Pending +| Disabled | No | Yes (Unsafe) | 0.88 @@ -304,6 +304,10 @@ end This cop enforces the use of `Array()` instead of explicit `Array` check or `[*var]`. +This cop is disabled by default because false positive will occur if +the argument of `Array()` is not an array (e.g. Hash, Set), +an array will be returned as an incompatibility result. + === Examples [source,ruby] diff --git a/lib/rubocop/cop/style/array_coercion.rb b/lib/rubocop/cop/style/array_coercion.rb index 73d75ceead8..b9e2c6488a5 100644 --- a/lib/rubocop/cop/style/array_coercion.rb +++ b/lib/rubocop/cop/style/array_coercion.rb @@ -5,6 +5,10 @@ module Cop module Style # This cop enforces the use of `Array()` instead of explicit `Array` check or `[*var]`. # + # This cop is disabled by default because false positive will occur if + # the argument of `Array()` is not an array (e.g. Hash, Set), + # an array will be returned as an incompatibility result. + # # @example # # bad # paths = [paths] unless paths.is_a?(Array)