-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
RSpec/ScatteredSetup
is marked as safe but misforms case statements
#1995
Comments
Can you please give an example?
|
Yes, here you go! |
I don’t think we have to account for RSpec DSL in case/if. |
Thanks @pirj -- It took my a moment to figure out what that means, I think it's that code like this should be refactored to pass params into the before block, etc and bring the case statements inside so that these errors are not generated by the autocorrect. I'm convinced that the Rubocop rule here doesn't need to accomadate these cases, but I'm not convinced that it should remain marked as safe for autocorrection. The examples here were perfectly validy Ruby/RSpec before, but are not after the autocorrect runs. |
In fact, for the example of hoisting to a higher context, I'm not convinced that is good behavior at all. But I'm confident neither case should be considered equivalent by design, as is the guideline for cops marked SafeForAutocorrect. |
Cop Doc: https://www.rubydoc.info/gems/rubocop-rspec/1.10.0/RuboCop/Cop/RSpec/ScatteredSetup
RSpec/ScatteredSetup
is not safe for autocorrection because it will movebefore
logic out of case statements and into one giant and many empty case statementsThe text was updated successfully, but these errors were encountered: