-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 wrong offense in Style/SymbolProc #9232
Fix wrong offense in Style/SymbolProc #9232
Conversation
f024850
to
66a5aa3
Compare
Thanks for catching this! You can fix this more simply by changing line 28 to |
436a13e
to
013154c
Compare
This is indeed a much better solution, thanks |
CHANGELOG.md
Outdated
@@ -6,6 +6,7 @@ | |||
|
|||
### Bug fixes | |||
|
|||
* [#9232](https://github.com/rubocop-hq/rubocop/pull/9232): Fix `Style/SymbolProc` registering wrong offense when using a symbol numbered block argument greater than 1, i.e. `[[1, 2]].map { _2.succ }`. ([@tdeo][]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You misplaced this changelog entry. Now they go under the changelog
dir and this file is auto-generated on release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, read the checklist a bit too fast and assumed it still was the same, I amended the commit
013154c
to
8b30828
Compare
Great, thanks! |
While upgrading to rubocop
1.6.1
, I noticed that theStyle/SymbolProc
was registering an offense on the following code:And suggesting to autocorrect to
array.map(&:first)
, which is incorrect in such case.I believe this was introduced in #9127
I suggest changing the cop to only register offenses for the
_1
numbered block argument.Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.