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 edge case in omit_parentheses style of Style/MethodCallWithArgsParentheses #7639

Merged
merged 1 commit into from Jan 10, 2020

Conversation

gsamokovarov
Copy link
Contributor

Before this change:

foo(a) || bar(b) do
             ^^^ Omit parentheses for method calls with arguments.
  pass
end

This resulted in a SyntaxError if corrected. The check for a call
with a logical operator did not take into account that the parent of a
send node with a block is the block node itself.

After this change, the code below is lawful:

foo(a) || bar(b) do
  pass
end

@gsamokovarov gsamokovarov force-pushed the omit-parentheses-rhs-of-operators branch from b8b59e2 to bd072df Compare January 8, 2020 10:30
@koic
Copy link
Member

koic commented Jan 9, 2020

This looks good to me. Can you rebase with the latest master branch?

@gsamokovarov gsamokovarov force-pushed the omit-parentheses-rhs-of-operators branch from bd072df to a12b152 Compare January 9, 2020 08:46
…ArgsParentheses`

Before this change:

```ruby
foo(a) || bar(b) do
             ^^^ Omit parentheses for method calls with arguments.
  pass
end
```

This resulted in a `SyntaxError`, if corrected. The check for a call
with logical operator did not take into account that the parent of a send node with a block is the block node itself.

After this change, the code below is lawful:

```ruby
foo(a) || bar(b) do
  pass
end
```
@gsamokovarov gsamokovarov force-pushed the omit-parentheses-rhs-of-operators branch from a12b152 to c7d6d76 Compare January 9, 2020 08:49
@gsamokovarov
Copy link
Contributor Author

Of course, I just rebased it.

@koic koic merged commit 7e37a77 into rubocop:master Jan 10, 2020
@koic
Copy link
Member

koic commented Jan 10, 2020

Thank you!

@gsamokovarov gsamokovarov deleted the omit-parentheses-rhs-of-operators branch January 10, 2020 13:06
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.

None yet

2 participants