-
-
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
False positive for the Layout/EmptyLinesAroundArguments cop #5224
Comments
Kyrylo's example actually involves arguments, but I'm seeing a false positive that does not involve arguments. module A
module B # <- offense on this line: "Empty line detected around arguments."
# .. 100 lines later ..
def c
d.
e(f).
# removing the blank line above fixes offense
g(h)
end
end
end |
Here's a short bit of nonsense code that still gets the false positive. Removing any remaining part makes the warning go away. (1..10).map do |number| # Rubocop complains about this line
next if number.even?
number
end.compact |
Another false positive here. A = [
1,
# comment
2
]
B = A + [
3,
4
]
Weirdly, deleting the assignment to I tried #5231 but it didn't help. |
We've got a lot of random false positive. Sometimes it's a class definition, sometimes it's a module, or an
|
It seems like location is reported incorrectly:
=>
|
I would agree with @printercu, I had the same issue, it would appear that it is the simply reporting the wrong location. It seems to give the offset within the block rather than the file. |
@eamonn-webster & @printercu - You are absolutely right. I'm able to confirm with a variety of examples, and I see/understand the problem in the code. Working on a solution now. |
I think I'm getting a false positive too for: sh('script.py', error_callback: lambda { |result|
error = JSON.parse(result, symbolize_names: true)
error_text = error[:error]
UI.user_error!("Error: #{error_text}")
}) at line 4 using RuboCop |
@revolter - You are correct. The final fixes for this cop are unreleased. You can test it against |
Ok, thanks for the quick update and confirmation! |
Use this file and run latest rubocop against it:
https://github.com/airbrake/airbrake/blob/v7.1.0/lib/airbrake/capistrano/capistrano2.rb
Expected behavior
No offence of the
Layout/EmptyLinesAroundArguments
copActual behavior
The offending lines are actually L18 & L21. I believe it's wrong to force me to format my strings how I want.
RuboCop version
The text was updated successfully, but these errors were encountered: