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
Enable Rubocop cop to omit parentheses from one-line method calls #2778
Conversation
This reads fine to me but I'm sure others will disagree. @dazuma @TheRoyalTnetennba can you weigh in on this? |
I'm OK with whatever style we agree on, but it seems to me it should be enforced. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -473,7 +473,7 @@ def labels_grpc | |||
return {} if labels.nil? | |||
# Coerce symbols to strings | |||
Hash[labels.map do |k, v| | |||
v = String(v) if v.is_a? Symbol | |||
v = String v if v.is_a? Symbol |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
It looks like rubocop/rubocop#6643 is likely to be merged, so I'm leaving this PR open. Will check again on Rubocop progress next week. |
rubocop/rubocop#6643 is merged. As it is a new feature, it will likely get released in rubocop version 0.64.0. |
09e09dd
to
ab2d5aa
Compare
@blowmage @dazuma I temporarily switched the Rubocop dependency to get @dazuma's new feature from rubocop/rubocop#6643: gem "rubocop", git: "git@github.com:rubocop-hq/rubocop.git", branch: "master" I then reverted the Kernel method calls to their original style, with parentheses. PTAL at the current style and let me know if it looks good. I'd be happy to do an additional gem such as BigQuery if it helps. |
@dazuma Your new feature Using rubocop 0.63.1 from git@github.com:rubocop-hq/rubocop.git (at master@d6e7a16)
...
Running RuboCop...
Warning: Style/MethodCallWithArgsParentheses does not support AllowParenthesesInCamelCaseMethod parameter.
Supported parameters are:
- Enabled
- IgnoreMacros
- IgnoredMethods
- AllowParenthesesInMultilineCall
- AllowParenthesesInChaining
- EnforcedStyle
- SupportedStyles
Inspecting 26 files
..........................
26 files inspected, no offenses detected |
@quartzmo Ah crap. That check slipped through while testing. Fix: rubocop/rubocop#6697 |
@quartzmo If you run against my branch, does the warning go away? gem "rubocop", git: "git@github.com:dazuma/rubocop.git", branch: "paren-param" |
@dazuma Looks good! Using rubocop 0.63.1 from git@github.com:dazuma/rubocop.git (at paren-param@a5a471a)
...
Chriss-iMac:google-cloud-logging quartzmo$ b rake rubocop
Running RuboCop...
Inspecting 26 files
..........................
26 files inspected, no offenses detected |
FYI the fix is now on rubocop master. |
The style looks good to me. 👍 for applying it to more gems. |
ab2d5aa
to
e893169
Compare
Added google-cloud-bigquery. |
google-cloud-bigquery/lib/google/cloud/bigquery/table/async_inserter.rb
Outdated
Show resolved
Hide resolved
Good news, Rubocop 0.64.0 was released with @dazuma's change. |
Enable Style/MethodCallWithArgsParentheses omit_parentheses [closes googleapis#2716]
Update .rubocop.yml to use AllowParenthesesInCamelCaseMethod
Add Style/MethodCallWithArgsParentheses.
Add Style/MethodCallWithArgsParentheses.
Add Style/MethodCallWithArgsParentheses.
Add Style/MethodCallWithArgsParentheses.
Add Style/MethodCallWithArgsParentheses.
1dd4046
to
7388b8e
Compare
Rebased to use rubocop |
21a4f68
to
dde9561
Compare
Add Style/MethodCallWithArgsParentheses.
Add Style/MethodCallWithArgsParentheses.
Add Style/MethodCallWithArgsParentheses.
Add Style/MethodCallWithArgsParentheses.
Add Style/MethodCallWithArgsParentheses.
Add Style/MethodCallWithArgsParentheses.
This PR currently applies this change only to google-cloud-logging. If the style is acceptable, please approve and I will apply to all manual gems, then request a full review.
Enable Style/MethodCallWithArgsParentheses omit_parentheses
[closes #2716]