KEMBAR78
Fix an error for `Style/ParallelAssignment` by koic · Pull Request #14373 · rubocop/rubocop · GitHub
Skip to content

Conversation

@koic
Copy link
Member

@koic koic commented Jul 19, 2025

This PR fixes the following error for Style/ParallelAssignment when a lambda with parallel assignment is used on the RHS.

$ echo 'a, b = x, -> { a, b = x, y}' | \
RUBOCOP_TARGET_RUBY_VERSION=3.0 bundle exec rubocop --stdin example.rb --only Style/ParallelAssignment -a -d
(snip)

An error occurred while Style/ParallelAssignment cop was inspecting
/Users/koic/src/github.com/rubocop/rubocop/example.rb:1:15.
Parser::Source::TreeRewriter detected clobbering

Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

This PR fixes the following error for `Style/ParallelAssignment`
when a lambda with parallel assignment is used on the RHS.

```console
$ echo 'a, b = x, -> { a, b = x, y}' | \
RUBOCOP_TARGET_RUBY_VERSION=3.0 bundle exec rubocop --stdin example.rb --only Style/ParallelAssignment -a -d
(snip)

An error occurred while Style/ParallelAssignment cop was inspecting
/Users/koic/src/github.com/rubocop/rubocop/example.rb:1:15.
Parser::Source::TreeRewriter detected clobbering
```
@bbatsov bbatsov merged commit 2fce6a1 into rubocop:master Jul 19, 2025
24 checks passed
@koic koic deleted the fix_an_error_for_style_parallel_assignment_cop branch July 19, 2025 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants