{"action":"created","issue":{"url":"https://api.github.com/repos/bbatsov/rubocop/issues/3649","repository_url":"https://api.github.com/repos/bbatsov/rubocop","labels_url":"https://api.github.com/repos/bbatsov/rubocop/issues/3649/labels{/name}","comments_url":"https://api.github.com/repos/bbatsov/rubocop/issues/3649/comments","events_url":"https://api.github.com/repos/bbatsov/rubocop/issues/3649/events","html_url":"https://github.com/bbatsov/rubocop/issues/3649","id":183837813,"number":3649,"title":"Style/RedundantReturn throws exception on case statement","user":{"login":"ptarjan","id":40143,"avatar_url":"https://avatars.githubusercontent.com/u/40143?v=3","gravatar_id":"","url":"https://api.github.com/users/ptarjan","html_url":"https://github.com/ptarjan","followers_url":"https://api.github.com/users/ptarjan/followers","following_url":"https://api.github.com/users/ptarjan/following{/other_user}","gists_url":"https://api.github.com/users/ptarjan/gists{/gist_id}","starred_url":"https://api.github.com/users/ptarjan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ptarjan/subscriptions","organizations_url":"https://api.github.com/users/ptarjan/orgs","repos_url":"https://api.github.com/users/ptarjan/repos","events_url":"https://api.github.com/users/ptarjan/events{/privacy}","received_events_url":"https://api.github.com/users/ptarjan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-19T00:37:01Z","updated_at":"2016-10-19T05:03:00Z","closed_at":null,"body":"On this file: \r\n```\r\n$ cat a.rb\r\ndef bar\r\n  case a\r\n  when 1\r\n  else\r\n    'oops'\r\n  end\r\nend\r\n```\r\n\r\nIt fails with this backtrace: \r\n\r\n```\r\nAn error occurred while Style/RedundantReturn cop was inspecting /private/tmp/a.rb.\r\nundefined method `type' for nil:NilClass\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/style/redundant_return.rb:79:in `check_branch'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/style/redundant_return.rb:102:in `check_when_node'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/style/redundant_return.rb:96:in `block in check_case_node'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/style/redundant_return.rb:96:in `each'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/style/redundant_return.rb:96:in `check_case_node'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/style/redundant_return.rb:81:in `check_branch'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/style/redundant_return.rb:75:in `on_method_def'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/mixin/on_method_def.rb:14:in `on_defs'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/commissioner.rb:41:in `block (2 levels) in on_defs'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/commissioner.rb:96:in `with_cop_error_handling'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/commissioner.rb:40:in `block in on_defs'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/commissioner.rb:39:in `each'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/commissioner.rb:39:in `on_defs'\r\n(eval):2:in `block in on_begin'\r\n(eval):2:in `each'\r\n(eval):2:in `on_begin'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/commissioner.rb:45:in `on_begin'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/ast_node/traversal.rb:141:in `on_while'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/commissioner.rb:45:in `on_module'\r\n(eval):2:in `block in on_begin'\r\n(eval):2:in `each'\r\n(eval):2:in `on_begin'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/commissioner.rb:45:in `on_begin'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/ast_node/traversal.rb:12:in `walk'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/commissioner.rb:58:in `investigate'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/team.rb:120:in `investigate'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/team.rb:108:in `offenses'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cop/team.rb:51:in `inspect_file'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/runner.rb:243:in `inspect_file'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/runner.rb:190:in `block in do_inspection_loop'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/runner.rb:222:in `block in iterate_until_no_changes'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/runner.rb:215:in `loop'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/runner.rb:215:in `iterate_until_no_changes'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/runner.rb:186:in `do_inspection_loop'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/runner.rb:101:in `block in file_offenses'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/runner.rb:111:in `file_offense_cache'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/runner.rb:99:in `file_offenses'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/runner.rb:90:in `process_file'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/runner.rb:68:in `block in each_inspected_file'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/runner.rb:65:in `each'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/runner.rb:65:in `reduce'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/runner.rb:65:in `each_inspected_file'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/runner.rb:57:in `inspect_files'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/runner.rb:36:in `run'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cli.rb:71:in `execute_runner'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/lib/rubocop/cli.rb:27:in `run'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/bin/rubocop:13:in `block in <top (required)>'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/2.2.0/benchmark.rb:303:in `realtime'\r\n/Users/pt/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rubocop-0.44.1/bin/rubocop:12:in `<top (required)>'\r\n/Users/pt/.rbenv/versions/2.2/bin/rubocop:23:in `load'\r\n/Users/pt/.rbenv/versions/2.2/bin/rubocop:23:in `<main>'\r\n.\r\n1 file inspected, no offenses detected\r\n\r\n1 error occurred:\r\nErrors are usually caused by RuboCop bugs.\r\nPlease, report your problems to RuboCop's issue tracker.\r\nMention the following information in the issue report:\r\n0.44.1 (using Parser 2.3.1.4, running on ruby 2.2.5 x86_64-darwin15)\r\nFinished in 0.1586333679999825 seconds\r\n```"},"comment":{"url":"https://api.github.com/repos/bbatsov/rubocop/issues/comments/254711135","html_url":"https://github.com/bbatsov/rubocop/issues/3649#issuecomment-254711135","issue_url":"https://api.github.com/repos/bbatsov/rubocop/issues/3649","id":254711135,"user":{"login":"Drenmi","id":5259935,"avatar_url":"https://avatars.githubusercontent.com/u/5259935?v=3","gravatar_id":"","url":"https://api.github.com/users/Drenmi","html_url":"https://github.com/Drenmi","followers_url":"https://api.github.com/users/Drenmi/followers","following_url":"https://api.github.com/users/Drenmi/following{/other_user}","gists_url":"https://api.github.com/users/Drenmi/gists{/gist_id}","starred_url":"https://api.github.com/users/Drenmi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Drenmi/subscriptions","organizations_url":"https://api.github.com/users/Drenmi/orgs","repos_url":"https://api.github.com/users/Drenmi/repos","events_url":"https://api.github.com/users/Drenmi/events{/privacy}","received_events_url":"https://api.github.com/users/Drenmi/received_events","type":"User","site_admin":false},"created_at":"2016-10-19T05:03:00Z","updated_at":"2016-10-19T05:03:00Z","body":"Pretty sure this was fixed in #3645, as I can no longer reproduce on current `master` using your example. 😀 "}}
{"actor":{"display_login":"Drenmi"}}