-
-
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
Rails - rubocop doesn't like syntax for model scopes #373
Comments
Ah, yes - scope(:foo, lambda) do |f|
where(condition: 'value')
end @jonas054 Will you please take care of this bug? |
As well, also this case: expect { do_something }.to raise_error(ErrorClass) { |error|
# ...
} |
@bbatsov @yujinakayama Yes. But how do we want RuboCop to act in these cases? Should it conclude that changing the braces to scope :foo, (lambda do |f|
where(condition: 'value')
end) and expect { do_something }.to(raise_error(ErrorClass) do |error|
# ...
end) respectively. |
I was thinking about making RuboCop accept |
That makes sense. I'll try to implement it. |
@jonas054 I'm still experiencing this in RuboCop 0.27.1. Is this fixed? |
@deivid-rodriguez Are you really? We're checking a few cases in the spec for the Do you have some example code where RuboCop still reports braces that actually can't be changed to |
Not actually, my bad. Don't know why I thought the resolution was allowing the |
@jonas054 I am still experiencing this. I ran this through the code for https://github.com/VisitMeet/visitmeet and it showed me the error everyone is having here. |
@bishisht Please open a new issue with the details of your problem. |
In my rails app, I have scopes that use the following syntax:
And when I rubocop my models, I get
C: Avoid using {...} for multi-line blocks.
When I replace the
{...}
form with ado..end
form, my scopes don't work.The text was updated successfully, but these errors were encountered: