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

Style/MethodCallWithArgsParentheses reports setter methods #4152

Closed
jonas054 opened this issue Mar 22, 2017 · 2 comments
Closed

Style/MethodCallWithArgsParentheses reports setter methods #4152

jonas054 opened this issue Mar 22, 2017 · 2 comments
Labels

Comments

@jonas054
Copy link
Collaborator

I think setter methods should never be reported by this cop. The user shouldn't have to add them to the IgnoredMethods configuration option.

Expected behavior

 $ echo 'x.y = 1' | rubocop --only Style/MethodCallWithArgsParentheses --stdin stdin.rb
Inspecting 1 file
.

1 file inspected, no offenses detected

Actual behavior

$ echo 'x.y = 1' | rubocop --only Style/MethodCallWithArgsParentheses --stdin stdin.rb
Inspecting 1 file
C

Offenses:

stdin.rb:1:3: C: Use parentheses for method calls with arguments.
x.y = 1
  ^

1 file inspected, 1 offense detected

Steps to reproduce the problem

Run the above command.

RuboCop version

Current master. The problem does not occur on 0.47.1.

@Drenmi
Copy link
Collaborator

Drenmi commented Mar 22, 2017

Agree with you @jonas054. Looks like a very meaningful adjustment.

@bbatsov bbatsov added the bug label Mar 28, 2017
@bbatsov
Copy link
Collaborator

bbatsov commented Mar 28, 2017

Agreed.

Drenmi added a commit to Drenmi/rubocop that referenced this issue Mar 31, 2017
…uire parens on setters

This cop would register an offense for setter methods without parens,
e.g.:

```
foo.bar = baz
```

This change fixes that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants