{"action":"created","issue":{"url":"https://api.github.com/repos/rubocop-hq/rubocop-rails/issues/22","repository_url":"https://api.github.com/repos/rubocop-hq/rubocop-rails","labels_url":"https://api.github.com/repos/rubocop-hq/rubocop-rails/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/rubocop-hq/rubocop-rails/issues/22/comments","events_url":"https://api.github.com/repos/rubocop-hq/rubocop-rails/issues/22/events","html_url":"https://github.com/rubocop-hq/rubocop-rails/issues/22","id":392575993,"node_id":"MDU6SXNzdWUzOTI1NzU5OTM=","number":22,"title":"New cop suggestion: check if a defined route has a corresponding controller action","user":{"login":"AlexVPopov","id":3239252,"node_id":"MDQ6VXNlcjMyMzkyNTI=","avatar_url":"https://avatars3.githubusercontent.com/u/3239252?v=4","gravatar_id":"","url":"https://api.github.com/users/AlexVPopov","html_url":"https://github.com/AlexVPopov","followers_url":"https://api.github.com/users/AlexVPopov/followers","following_url":"https://api.github.com/users/AlexVPopov/following{/other_user}","gists_url":"https://api.github.com/users/AlexVPopov/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexVPopov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexVPopov/subscriptions","organizations_url":"https://api.github.com/users/AlexVPopov/orgs","repos_url":"https://api.github.com/users/AlexVPopov/repos","events_url":"https://api.github.com/users/AlexVPopov/events{/privacy}","received_events_url":"https://api.github.com/users/AlexVPopov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-12-19T12:20:34Z","updated_at":"2018-12-20T08:34:04Z","closed_at":null,"author_association":"NONE","body":"My suggestion is to have a cop, which checks, that all defined routes in `config/routes.rb` have corresponding controller actions. For example, if we define:\r\n\r\n```ruby\r\nresources :countries\r\n```\r\nthe following routes are generated:\r\n\r\n```\r\n                countries GET    /countries(.:format)                                                                     countries#index\r\n                          POST   /countries(.:format)                                                                     countries#create\r\n              new_country GET    /countries/new(.:format)                                                                 countries#new\r\n             edit_country GET    /countries/:id/edit(.:format)                                                            countries#edit\r\n                  country GET    /countries/:id(.:format)                                                                 countries#show\r\n                          PATCH  /countries/:id(.:format)                                                                 countries#update\r\n                          PUT    /countries/:id(.:format)                                                                 countries#update\r\n                          DELETE /countries/:id(.:format)                                                                 countries#destroy\r\n```\r\nHowever, if the controller has only implemented the `#index` action:\r\n```ruby\r\nclass CountriesController < ApplicationController\r\n  def index\r\n    render json: Country.all\r\n  end\r\nend\r\n```\r\nthe cop should raise an error/warning."},"comment":{"url":"https://api.github.com/repos/rubocop-hq/rubocop-rails/issues/comments/448915953","html_url":"https://github.com/rubocop-hq/rubocop-rails/issues/22#issuecomment-448915953","issue_url":"https://api.github.com/repos/rubocop-hq/rubocop-rails/issues/22","id":448915953,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0ODkxNTk1Mw==","user":{"login":"AlexVPopov","id":3239252,"node_id":"MDQ6VXNlcjMyMzkyNTI=","avatar_url":"https://avatars3.githubusercontent.com/u/3239252?v=4","gravatar_id":"","url":"https://api.github.com/users/AlexVPopov","html_url":"https://github.com/AlexVPopov","followers_url":"https://api.github.com/users/AlexVPopov/followers","following_url":"https://api.github.com/users/AlexVPopov/following{/other_user}","gists_url":"https://api.github.com/users/AlexVPopov/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexVPopov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexVPopov/subscriptions","organizations_url":"https://api.github.com/users/AlexVPopov/orgs","repos_url":"https://api.github.com/users/AlexVPopov/repos","events_url":"https://api.github.com/users/AlexVPopov/events{/privacy}","received_events_url":"https://api.github.com/users/AlexVPopov/received_events","type":"User","site_admin":false},"created_at":"2018-12-20T08:34:04Z","updated_at":"2018-12-20T08:34:04Z","author_association":"NONE","body":"@andyw8 Andy, I guess this could be integrated into the logic of the cop, it's a matter of catching all edge cases, I assume."}}
{"actor":{"display_login":"AlexVPopov"}}