Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix #8783] Disable Style/ArrayCoercion cop by default #8792

Merged
merged 1 commit into from Sep 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion config/default.yml
Expand Up @@ -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:
Expand Down
6 changes: 5 additions & 1 deletion docs/modules/ROOT/pages/cops_style.adoc
Expand Up @@ -295,7 +295,7 @@ end
|===
| Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged

| Pending
| Disabled
| No
| Yes (Unsafe)
| 0.88
Expand All @@ -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]
Expand Down
4 changes: 4 additions & 0 deletions lib/rubocop/cop/style/array_coercion.rb
Expand Up @@ -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)
Expand Down