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

Make Rails/HttpStatus aware of rendering with head #490

Closed
anthony-robin opened this issue May 20, 2021 · 0 comments · Fixed by #493
Closed

Make Rails/HttpStatus aware of rendering with head #490

anthony-robin opened this issue May 20, 2021 · 0 comments · Fixed by #493
Labels
enhancement New feature or request

Comments

@anthony-robin
Copy link
Contributor

Is your feature request related to a problem? Please describe.

This request is for an enhancement of the actual Rails/HttpStatus cop.
Indeed, current cop detects render and redirect_to but not head.

Describe the solution you'd like

I would like the cop to detect an offense when rendering HTTP status using head keyword.

def my_action
  head 200 # should flag an offense and ask to replace with :ok
end

Describe alternatives you've considered

No alternative

Additional context

$ rubocop -V
1.14.0 (using Parser 3.0.1.1, rubocop-ast 1.5.0, running on ruby 2.6.6 x86_64-darwin20)
  - rubocop-performance 1.11.3
  - rubocop-rails 2.10.1
  - rubocop-rspec 2.3.0
@koic koic added the enhancement New feature or request label May 21, 2021
koic added a commit to koic/rubocop-rails that referenced this issue May 22, 2021
Fixes rubocop#490.

This PR makes `Rails/HttpStatus` aware of `head` method.
koic added a commit to koic/rubocop-rails that referenced this issue May 24, 2021
Fixes rubocop#490.

This PR makes `Rails/HttpStatus` aware of `head` method.
koic added a commit to koic/rubocop-rails that referenced this issue Jun 3, 2021
Fixes rubocop#490.

This PR makes `Rails/HttpStatus` aware of `head` method.
@koic koic closed this as completed in #493 Jun 3, 2021
koic added a commit that referenced this issue Jun 3, 2021
…d_method

[Fix #490] Make `Rails/HttpStatus` aware of `head` method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants