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

Allow parentheses in yield arguments for Style/MethodCallWithArgsParentheses #9625

Merged
merged 1 commit into from Mar 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1 @@
* [#9625](https://github.com/rubocop/rubocop/pull/9625): Allow parentheses in yield arguments with `Style/MethodCallWithArgsParentheses` `EnforcedStyle: omit_parentheses` to fix invalid Ruby auto-correction. ([@gsamokovarov][])
Expand Up @@ -114,7 +114,7 @@ def call_with_braced_block?(node)
def call_as_argument_or_chain?(node)
node.parent &&
(node.parent.send_type? && !assigned_before?(node.parent, node) ||
node.parent.csend_type? || node.parent.super_type?)
node.parent.csend_type? || node.parent.super_type? || node.parent.yield_type?)
end

def hash_literal_in_arguments?(node)
Expand Down
Expand Up @@ -658,6 +658,11 @@ def seatle_style arg: default(42)
expect_no_offenses('foo &block')
end

it 'accepts parens in yield argument method calls' do
expect_no_offenses('yield File.basepath(path)')
expect_no_offenses('yield path, File.basepath(path)')
end

it 'accepts parens in super without args' do
expect_no_offenses('super()')
end
Expand Down