Open hfvmarques opened 4 days ago
Do I read it correctly that Style/HashSyntax‘s autocorrection is causing syntax errors? Can you open an issue with them?
I’m not too familiar with the syntax, it looks like it expects the value for the keyword argument on the next line?
I am not convinced that this “shorthand” syntax is for the good, as it makes it less obvious that many keyword arguments are fine, when they usually are a sign of a design that can be improved.
To me, I’d say that it’s Style/HashSyntax‘s problem with autocorrecting, and that it shouldn’t even bother RSpec DSL, and would recommend disabling it in spec/.rubocop.yml
It's been a while that sometimes I'm getting this. I always have a "workaround" but it's not pretty, but I think that this could be addressed properly.
When you have a before block, and inside there is more than a factory, and within that creates/builds there are hashes with the same name in key/value, there is a crossroad (I don't know if that's a good word). I'll explain:
The code above raises the flag of Style/HashSyntax, so we have to do this:
But the code above does not run because of Ruby sintax error, so we have to do this:
But if you have the omit_parenthesis EnforcedStyle, it raises the flag of FactoryBot/ConsistentParenthesesStyle.
So, there you have it. Sometime when there are other attributes to use, I put the last one that does not have the same name in key/value such as this:
Or even get some more lines in it like this:
But that's very ugly.
So, do you guys think this is a ruby problem, a rubocop problem or a rubocop-factory_bot problem?