diff --git a/CHANGELOG.md b/CHANGELOG.md index 4150c515d02..5d95480a8e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Changes * [#8362](https://github.com/rubocop-hq/rubocop/issues/8362): Add numbers of correctable offenses to summary. ([@nguyenquangminh0711][]) +* [#8513](https://github.com/rubocop-hq/rubocop/pull/8513): Clarify the ruby warning mentioned in the `Lint/ShadowingOuterLocalVariable` documentation. ([@chocolateboy][]) ## 0.89.1 (2020-08-10) @@ -4778,3 +4779,4 @@ [@sonalinavlakhe]: https://github.com/sonalinavlakhe [@wcmonty]: https://github.com/wcmonty [@nguyenquangminh0711]: https://github.com/nguyenquangminh0711 +[@chocolateboy]: https://github.com/chocolateboy diff --git a/docs/modules/ROOT/pages/cops_lint.adoc b/docs/modules/ROOT/pages/cops_lint.adoc index aad7d1e956d..07f0c9f420f 100644 --- a/docs/modules/ROOT/pages/cops_lint.adoc +++ b/docs/modules/ROOT/pages/cops_lint.adoc @@ -3481,10 +3481,10 @@ end | - |=== -This cop looks for use of the same name as outer local variables -for block arguments or block local variables. -This is a mimic of the warning -"shadowing outer local variable - foo" from `ruby -cw`. +This cop checks for the use of local variable names from an outer scope +in block arguments or block-local variables. This mirrors the warning +given by `ruby -cw` prior to Ruby 2.6: +"shadowing outer local variable - foo". === Examples diff --git a/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb b/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb index 02e2592a77d..7fcd3cc7856 100644 --- a/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +++ b/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb @@ -3,10 +3,10 @@ module RuboCop module Cop module Lint - # This cop looks for use of the same name as outer local variables - # for block arguments or block local variables. - # This is a mimic of the warning - # "shadowing outer local variable - foo" from `ruby -cw`. + # This cop checks for the use of local variable names from an outer scope + # in block arguments or block-local variables. This mirrors the warning + # given by `ruby -cw` prior to Ruby 2.6: + # "shadowing outer local variable - foo". # # @example #