Skip to content
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

[Fix #352] Do not register an offense for Rails/HttpPositionalArguments when given a splatted hash #354

Merged
merged 1 commit into from Sep 12, 2020

Conversation

dvandersluis
Copy link
Member

The following code will no longer register an offense:

[{ format: :json }, { format: :html }].each do |args|
  get :nothing, **args
end

Fixes #352.


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • If this is a new cop, consider making a corresponding update to the Rails Style Guide.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

@dvandersluis dvandersluis changed the title [Fix #352] Do not register an offense for Rails/HttpPositionalArguments when given a splatted hash. [Fix #352] Do not register an offense for Rails/HttpPositionalArguments when given a splatted hash Sep 10, 2020
@@ -16,6 +16,11 @@ module Rails
#
# # good
# get :new, params: { user_id: 1 }
#
# # good
Copy link
Contributor

@andyw8 andyw8 Sep 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary to include, it's not such a common approach.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about simplified to get :new, **options? I think that might be more straightforward?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andyw8 I made the change I suggested, but if you still don't like it I'm happy to remove it!

@koic koic merged commit c2d3ade into rubocop:master Sep 12, 2020
@koic
Copy link
Member

koic commented Sep 12, 2020

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autocorrection of Rails/HttpPositionalArguments removes keyword-splat arguments
3 participants