-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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/MultilineHashBraceLayout still flagging single lines #3256
Comments
@NekoNova: I can not reproduce this using |
I cannot run that version due other bug with the. Rubyversion file
|
I've upgraded Rubocop to Right now I's throwing me the following error:
The offending code is the following:
This code should be accepted when using the |
The following snippet in our specs is not accepted either:
|
First of all it's the I think its behavior, as far as detecting offenses is concerned, is consistent with the description in Style/MultilineMethodCallBraceLayout:
EnforcedStyle: symmetrical
SupportedStyles:
# symmetrical: closing brace is positioned in same way as opening brace
# new_line: closing brace is always on a new line
# same_line: closing brace is always on the same line as last argument
- symmetrical
- new_line
- same_line Note: "closing brace is always on a new line". The problem is that the cop highlights the wrong thing. Since all the messages talk about what's wrong with the closing bracket (or brace as this cop calls it), this is what we should highlight.
I'll submit a PR soon. |
that makes more sense. |
… cops The closing brace is what the cops are reporting, so that's what we should highlight. It's easy to misunderstand the reports otherwise.
… cops (rubocop#3337) The closing brace is what the cops are reporting, so that's what we should highlight. It's easy to misunderstand the reports otherwise.
Hello,
I previously reported the issue with the Multiline cops flagging single line statements as false positive.
This is still happening with the
Style/MultilineHashBraceLayout
Cop.Expected behavior
Do not flag single line statements as offense when using the
EnforcedStyle: new_line
option.Actual behavior
Single lines are flagged as violation.
Steps to reproduce the problem
Style/MultilineHashBraceLayout
EnforcedStyle: new_line
The following code for example get's flagged:
RuboCop version
Include the output of
rubocop -V
:The text was updated successfully, but these errors were encountered: