Following my report of #1442 I've had reason to run this cop on some of our other projects and have found two more scenarios where autocorrection of FactoryBot/ConsistentParenthesesStyle with omit_parentheses: true will remove parentheses in a way that produces invalid syntax. In fact it might even be the case these shouldn't be offenses as they cannot be corrected in this way?
Here's a contrived example file spec/models/user_spec.rb to demo my points:
And the resulting file has a couple of syntax errors (all the invoice_line factories in an array are broken, as is the team factory as a value in a hash):
These usages of factorys are not something I actually like - they should probably get a refactor :) - but they're what we've got right now and the rubocop autocorrect shouldn't be mangling them into invalid syntax.
Following my report of #1442 I've had reason to run this cop on some of our other projects and have found two more scenarios where autocorrection of FactoryBot/ConsistentParenthesesStyle with omit_parentheses: true will remove parentheses in a way that produces invalid syntax. In fact it might even be the case these shouldn't be offenses as they cannot be corrected in this way?
Here's a contrived example file
spec/models/user_spec.rb
to demo my points:Run
rubocop -a spec/models/user_spec.rb
:And the resulting file has a couple of syntax errors (all the
invoice_line
factories in an array are broken, as is theteam
factory as a value in a hash):These usages of factorys are not something I actually like - they should probably get a refactor :) - but they're what we've got right now and the rubocop autocorrect shouldn't be mangling them into invalid syntax.
Rubocop version