-
-
Notifications
You must be signed in to change notification settings - Fork 261
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 #822] Extends Rails/HttpStatus
cop to check routes.rb
#823
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes rubocop#822. This PR extends `Rails/HttpStatus` to detects offenses in `routes.rb` on redirections: ```ruby Rails.application.routes.draw do get '/foobar', to: redirect('/foobar/baz', status: 301) end ```
Thanks! |
I think this PR should be reverted because it appears that Rails doesn't support symbols in
I'm not sure why the error did not occur earlier to me so sorry for this mess :( |
jdufresne
added a commit
to jdufresne/rubocop-rails
that referenced
this pull request
Oct 23, 2022
…-routes" This reverts commit e40d8b9, reversing changes made to 6051ed8. The auto-corrected code is not compatible with Rails/Puma, resulting the error: Puma caught this error: undefined method `to_i' for :moved_permanently:Symbol status = status.to_i ^^^^^ Did you mean? to_s (NoMethodError) /.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/puma-5.6.5/lib/puma/request.rb:82:in `handle_request' /.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/puma-5.6.5/lib/puma/server.rb:443:in `process_client' /.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/puma-5.6.5/lib/puma/thread_pool.rb:147:in `block in spawn_thread'
jdufresne
added a commit
to jdufresne/rubocop-rails
that referenced
this pull request
Oct 23, 2022
…-routes" This reverts commit e40d8b9, reversing changes made to 6051ed8. The auto-corrected code is not compatible with Rails/Puma, resulting the error: Puma caught this error: undefined method `to_i' for :moved_permanently:Symbol status = status.to_i ^^^^^ Did you mean? to_s (NoMethodError) /.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/puma-5.6.5/lib/puma/request.rb:82:in `handle_request' /.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/puma-5.6.5/lib/puma/server.rb:443:in `process_client' /.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/puma-5.6.5/lib/puma/thread_pool.rb:147:in `block in spawn_thread'
jdufresne
added a commit
to jdufresne/rubocop-rails
that referenced
this pull request
Oct 23, 2022
…-routes" This reverts commit e40d8b9, reversing changes made to 6051ed8. The auto-corrected code is not compatible with Rails/Puma, resulting the error: Puma caught this error: undefined method `to_i' for :moved_permanently:Symbol status = status.to_i ^^^^^ Did you mean? to_s (NoMethodError) /.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/puma-5.6.5/lib/puma/request.rb:82:in `handle_request' /.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/puma-5.6.5/lib/puma/server.rb:443:in `process_client' /.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/puma-5.6.5/lib/puma/thread_pool.rb:147:in `block in spawn_thread'
I observed the same issue. I opened #829 to do the revert. |
jdufresne
added a commit
to jdufresne/rubocop-rails
that referenced
this pull request
Oct 23, 2022
…-routes" This reverts commit e40d8b9, reversing changes made to 6051ed8. The auto-corrected code is not compatible with Rails/Puma, resulting the error: Puma caught this error: undefined method `to_i' for :moved_permanently:Symbol status = status.to_i ^^^^^ Did you mean? to_s (NoMethodError) /.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/puma-5.6.5/lib/puma/request.rb:82:in `handle_request' /.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/puma-5.6.5/lib/puma/server.rb:443:in `process_client' /.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/puma-5.6.5/lib/puma/thread_pool.rb:147:in `block in spawn_thread'
Also getting hit by this. |
koic
added a commit
that referenced
this pull request
Oct 25, 2022
Revert "Merge pull request #823 from anthony-robin/http-status-routes"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #822.
This PR extends
Rails/HttpStatus
cop to detects offenses inroutes.rb
on redirections:Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.