{"action":"created","issue":{"url":"https://api.github.com/repos/rubocop-hq/rubocop/issues/6509","repository_url":"https://api.github.com/repos/rubocop-hq/rubocop","labels_url":"https://api.github.com/repos/rubocop-hq/rubocop/issues/6509/labels{/name}","comments_url":"https://api.github.com/repos/rubocop-hq/rubocop/issues/6509/comments","events_url":"https://api.github.com/repos/rubocop-hq/rubocop/issues/6509/events","html_url":"https://github.com/rubocop-hq/rubocop/issues/6509","id":383067491,"node_id":"MDU6SXNzdWUzODMwNjc0OTE=","number":6509,"title":"Style/RaiseArgs auto correction to invalid syntax","user":{"login":"DMA57361","id":1375133,"node_id":"MDQ6VXNlcjEzNzUxMzM=","avatar_url":"https://avatars3.githubusercontent.com/u/1375133?v=4","gravatar_id":"","url":"https://api.github.com/users/DMA57361","html_url":"https://github.com/DMA57361","followers_url":"https://api.github.com/users/DMA57361/followers","following_url":"https://api.github.com/users/DMA57361/following{/other_user}","gists_url":"https://api.github.com/users/DMA57361/gists{/gist_id}","starred_url":"https://api.github.com/users/DMA57361/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DMA57361/subscriptions","organizations_url":"https://api.github.com/users/DMA57361/orgs","repos_url":"https://api.github.com/users/DMA57361/repos","events_url":"https://api.github.com/users/DMA57361/events{/privacy}","received_events_url":"https://api.github.com/users/DMA57361/received_events","type":"User","site_admin":false},"labels":[{"id":3608332,"node_id":"MDU6TGFiZWwzNjA4MzMy","url":"https://api.github.com/repos/rubocop-hq/rubocop/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-21T11:08:07Z","updated_at":"2018-11-23T09:07:43Z","closed_at":null,"author_association":"NONE","body":"I'm running corrections over some older code that hasn't been looked after by Rubocop before, and I've just had the Style/RaiseArgs cop auto-correct a raise that used a dynamically assigned exception class into invalid code.\r\n\r\nSpecifically the line affected was equivalent to `raise klass.new('oh no')`\r\n\r\n## Expected behavior\r\n\r\nCorrect to `raise klass, 'on no'`\r\n\r\n## Actual behavior\r\n\r\nThe line is corrected to `raise , 'oh no'`\r\n\r\n## Steps to reproduce the problem\r\n\r\nGiven this contrived `eg.rb` file:\r\n\r\n```ruby\r\ndef do_a_thing\r\n  klass = RuntimeError\r\n  raise klass.new('oh no')\r\nend\r\n```\r\n\r\nRun Rubocop corrections:\r\n\r\n```\r\n$ bundle exec rubocop --safe-auto-correct eg.rb\r\nInspecting 1 file\r\nE\r\n\r\nOffenses:\r\n\r\neg.rb:3:3: C: [Corrected] Style/RaiseArgs: Provide an exception class and message as arguments to raise.\r\n  raise klass.new('oh no')\r\n  ^^^^^^^^^^^^^^^^^^^^^^^^\r\neg.rb:3:18: E: Lint/Syntax: unexpected token tNL\r\n(Using Ruby 2.3 parser; configure using TargetRubyVersion parameter, under AllCops)\r\n  raise , 'oh no' ...\r\n\r\n\r\n1 file inspected, 2 offenses detected, 1 offense corrected\r\n```\r\n\r\nThe `eg.rb` file is left in this state:\r\n\r\n```ruby\r\ndef do_a_thing\r\n  klass = RuntimeError\r\n  raise , 'oh no'\r\nend\r\n```\r\n\r\n## RuboCop version\r\n\r\n```\r\n$ bundle exec rubocop -V\r\n0.60.0 (using Parser 2.5.3.0, running on ruby 2.3.7 x86_64-darwin18)\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/rubocop-hq/rubocop/issues/comments/441186216","html_url":"https://github.com/rubocop-hq/rubocop/issues/6509#issuecomment-441186216","issue_url":"https://api.github.com/repos/rubocop-hq/rubocop/issues/6509","id":441186216,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MTE4NjIxNg==","user":{"login":"koic","id":13203,"node_id":"MDQ6VXNlcjEzMjAz","avatar_url":"https://avatars3.githubusercontent.com/u/13203?v=4","gravatar_id":"","url":"https://api.github.com/users/koic","html_url":"https://github.com/koic","followers_url":"https://api.github.com/users/koic/followers","following_url":"https://api.github.com/users/koic/following{/other_user}","gists_url":"https://api.github.com/users/koic/gists{/gist_id}","starred_url":"https://api.github.com/users/koic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koic/subscriptions","organizations_url":"https://api.github.com/users/koic/orgs","repos_url":"https://api.github.com/users/koic/repos","events_url":"https://api.github.com/users/koic/events{/privacy}","received_events_url":"https://api.github.com/users/koic/received_events","type":"User","site_admin":false},"created_at":"2018-11-23T09:07:43Z","updated_at":"2018-11-23T09:07:43Z","author_association":"MEMBER","body":"Thanks for the feedback. I opened a PR #6515."}}
{"actor":{"display_login":"koic"}}