Sha256: a6dcddbecebf9ab537977b3f5462d9637a8af44be3172faa5b9afac06d62a0f7
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
# frozen_string_literal: true module RailsBestPractices module Reviews # Review config/routes file to make sure not use default route that rails generated. # # See the best practice details here https://rails-bestpractices.com/posts/2010/07/22/not-use-default-route-if-you-use-restful-design/ # # Implementation: # # Review process: # check all method command_call or command node to see if it is the same as rails default route. # # map.connect ':controller/:action/:id' # map.connect ':controller/:action/:id.:format' # # or # # match ':controller(/:action(/:id(.:format)))' class NotUseDefaultRouteReview < Review interesting_nodes :command_call, :command interesting_files ROUTE_FILES url 'https://rails-bestpractices.com/posts/2010/07/22/not-use-default-route-if-you-use-restful-design/' # check all command nodes add_callback :start_command do |node| if 'match' == node.message.to_s && ':controller(/:action(/:id(.:format)))' == node.arguments.all.first.to_s add_error 'not use default route' end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails_best_practices-1.19.3 | lib/rails_best_practices/reviews/not_use_default_route_review.rb |
rails_best_practices-1.19.2 | lib/rails_best_practices/reviews/not_use_default_route_review.rb |