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

@gsamokovarov gsamokovarov commented Mar 22, 2021

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 gsamokovarov:omit-parentheses-string-interpolation branch 2 times, most recently from 8f784a7 to 6791c1d Mar 22, 2021
…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 gsamokovarov:omit-parentheses-string-interpolation branch from 6791c1d to a34a957 Mar 22, 2021
@gsamokovarov
Copy link
Contributor Author

@gsamokovarov gsamokovarov commented Mar 22, 2021

I have moved the changelog and rewrote the documentation examples.

@bbatsov bbatsov merged commit aa266c1 into rubocop:master Mar 22, 2021
31 checks passed
31 checks passed
@github-actions
windows 2.4
Details
@github-actions
windows 2.5
Details
@github-actions
windows 2.6
Details
@github-actions
windows 2.7
Details
@github-actions
windows 3.0
Details
@github-actions
windows mingw
Details
@mergify
Summary 2 potential rules
Details
ci/circleci: cc-setup Your tests passed on CircleCI!
Details
ci/circleci: cc-upload-coverage Your tests passed on CircleCI!
Details
ci/circleci: documentation-checks Your tests passed on CircleCI!
Details
ci/circleci: jruby-9.2-ascii_spec Your tests passed on CircleCI!
Details
ci/circleci: jruby-9.2-rubocop Your tests passed on CircleCI!
Details
ci/circleci: jruby-9.2-spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.4-ascii_spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.4-rubocop Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.4-spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.5-ascii_spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.5-rubocop Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.5-spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.6-ascii_spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.6-rubocop Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.6-spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.7-ascii_spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.7-rubocop Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.7-spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-3.0-ascii_spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-3.0-rubocop Your tests passed on CircleCI!
Details
ci/circleci: ruby-3.0-spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-head-ascii_spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-head-rubocop Your tests passed on CircleCI!
Details
ci/circleci: ruby-head-spec Your tests passed on CircleCI!
Details
@gsamokovarov gsamokovarov deleted the gsamokovarov:omit-parentheses-string-interpolation branch Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants