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

Calls with braces in interpolation for Style/MethodCallWithArgsParentheses #9629

Merged

Conversation

gsamokovarov
Copy link
Contributor

If we are calling methods in string interpolation with the omit_parentheses
style for the Style/MethodCallWithArgsParentheses cop, they are
currently forced to be without parentheses:

"#{part 1}, #{part 2}, #{part 3}"

My coworkers at Dext want to be able to put spaces while calling methods
in interpolation, and I don't blame them. Having spaces reduces the
noise of following a method call in a string, especially if the string
happens to have multiple interpolations in it.

I want to add the AllowParenthesesInStringInterpolation cop configuration
that allows the use of parentheses in string interpolation calls.

"#{part(1)}, #{part(2)}, #{part(3)}"

CHANGELOG.md Outdated Show resolved Hide resolved
@gsamokovarov gsamokovarov force-pushed the omit-parentheses-string-interpolation branch 2 times, most recently from 8f784a7 to 6791c1d Compare March 22, 2021 07:24
…heses

If we are calling methods in string interpolation with the `omit_parentheses`
style for the `Style/MethodCallWithArgsParentheses` cop, they are
currently forced to be without parentheses:

```ruby
"#{part 1}, #{part 2}, #{part 3}"
```

My coworkers at Dext want to be able to put spaces while calling methods
in interpolation, and I don't blame them. Having spaces reduces the
noise of following a method call in a string, especially if the string
happens to have multiple interpolations in it.

I want to add the `AllowParenthesesInStringInterpolation` cop configuration
that allows the use of parentheses in string interpolation calls.

```ruby
"#{part(1)}, #{part(2)}, #{part(3)}"
```
@gsamokovarov gsamokovarov force-pushed the omit-parentheses-string-interpolation branch from 6791c1d to a34a957 Compare March 22, 2021 12:41
@gsamokovarov
Copy link
Contributor Author

I have moved the changelog and rewrote the documentation examples.

@bbatsov bbatsov merged commit aa266c1 into rubocop:master Mar 22, 2021
@gsamokovarov gsamokovarov deleted the omit-parentheses-string-interpolation branch March 23, 2021 07:27
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