Open andreynering opened 4 years ago
I think format
is not supported keyword. See https://api.rubyonrails.org/classes/ActionController/TestCase/Behavior.html#method-i-get It is fair for rubocop to think of it as any other parameter.
In fact, we have an explicit test-case for this: https://github.com/rubocop-hq/rubocop-rails/blob/38840ddbdcd0ac3a0b56ee4c169a10e5dca00cad/spec/rubocop/cop/rails/http_positional_arguments_spec.rb#L368-L377
I've the same problem with a supported argument:
def authorized_post(path, options = {})
- post path, { headers: { 'Api-Key': api_access.key }, as: :json }.merge(options)
+ post path, params: { headers: { 'Api-Key': api_access.key }, as: :json }.merge(options)
end
The suggested change is wrong and I don't think this is easily auto-correctable because the correction would go into this direction:
post path, params: options[:params],
headers: { 'Api-Key': api_access.key }.merge(options[:headers] || {}),
as: :json
@schmijos This seems different from the original issue. It is mostly because of the parens and merge
.
Expected behavior
This:
Should be converted to:
Actual behavior
But it's actually converted to:
In some situations, I've seen it been put inside the
session
keyword (?):RuboCop version