Skip to content

Commit

Permalink
Merge pull request #10429 from issyl0/style/for-unsafe
Browse files Browse the repository at this point in the history
[Fix #10427] Style/For: Mark auto-correction as unsafe
  • Loading branch information
koic committed Feb 21, 2022
2 parents aa47871 + fde1653 commit 3021297
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/change_mark_style_for_as_unsafe.md
@@ -0,0 +1 @@
* [#10427](https://github.com/rubocop/rubocop/issues/10427): Mark `Style/For` as unsafe auto-correction. ([@issyl0][])
3 changes: 2 additions & 1 deletion config/default.yml
Expand Up @@ -3544,8 +3544,9 @@ Style/For:
Description: 'Checks use of for or each in multiline loops.'
StyleGuide: '#no-for-loops'
Enabled: true
SafeAutoCorrect: false
VersionAdded: '0.13'
VersionChanged: '0.59'
VersionChanged: '<<next>>'
EnforcedStyle: each
SupportedStyles:
- each
Expand Down
4 changes: 4 additions & 0 deletions lib/rubocop/cop/style/for.rb
Expand Up @@ -38,6 +38,10 @@ module Style
# end
# end
#
# @safety
# This cop's autocorrection is unsafe because the scope of
# variables is different between `each` and `for`.
#
class For < Base
include ConfigurableEnforcedStyle
include RangeHelp
Expand Down

0 comments on commit 3021297

Please sign in to comment.