{"action":"created","issue":{"url":"https://api.github.com/repos/bbatsov/rubocop/issues/4481","repository_url":"https://api.github.com/repos/bbatsov/rubocop","labels_url":"https://api.github.com/repos/bbatsov/rubocop/issues/4481/labels{/name}","comments_url":"https://api.github.com/repos/bbatsov/rubocop/issues/4481/comments","events_url":"https://api.github.com/repos/bbatsov/rubocop/issues/4481/events","html_url":"https://github.com/bbatsov/rubocop/issues/4481","id":234603080,"number":4481,"title":"Style/SymbolArray auto-correct creating invalid syntax","user":{"login":"bbugh","id":438465,"avatar_url":"https://avatars0.githubusercontent.com/u/438465?v=3","gravatar_id":"","url":"https://api.github.com/users/bbugh","html_url":"https://github.com/bbugh","followers_url":"https://api.github.com/users/bbugh/followers","following_url":"https://api.github.com/users/bbugh/following{/other_user}","gists_url":"https://api.github.com/users/bbugh/gists{/gist_id}","starred_url":"https://api.github.com/users/bbugh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbugh/subscriptions","organizations_url":"https://api.github.com/users/bbugh/orgs","repos_url":"https://api.github.com/users/bbugh/repos","events_url":"https://api.github.com/users/bbugh/events{/privacy}","received_events_url":"https://api.github.com/users/bbugh/received_events","type":"User","site_admin":false},"labels":[{"id":3608332,"url":"https://api.github.com/repos/bbatsov/rubocop/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-06-08T17:37:48Z","updated_at":"2017-06-10T07:02:37Z","closed_at":null,"body":"This seems to be more of surprising behavior with the Ruby parser than Rubocop, but nonetheless it is still creating errors.\r\n\r\n```\r\n# original, valid syntax, pre-Rubocop\r\nprepend_before_filter only: [ :create, :destroy ] { request.env[\"devise.skip_timeout\"] = true }\r\n\r\n# invalid (Ruby 2.2.4) syntax created by Rubocop\r\nprepend_before_filter only: %i[create destroy] { request.env[\"devise.skip_timeout\"] = true }\r\n```\r\n\r\nThe Ruby error:\r\n\r\n```\r\napp/controllers/users/sessions_controller.rb:4: syntax error, unexpected '{', expecting keyword_end\r\n...tion only: %i[create destroy] { request.env['devise.skip_tim...\r\n...                               ^\r\napp/controllers/users/sessions_controller.rb:4: syntax error, unexpected '}', expecting keyword_end\r\n```\r\n\r\n--------\r\n\r\n## Expected behavior\r\n\r\nWhen running `rubocop -a`, it produces valid Ruby syntax.\r\n\r\n## Actual behavior\r\n\r\nIt creates invalid syntax.\r\n\r\n## Steps to reproduce the problem\r\n\r\n1. Given a file:\r\n    ```ruby\r\n    # thing.rb\r\n    class Thing\r\n      do_anything only: [:word, :two] { 5 }\r\n    end\r\n    ```\r\n\r\n2. When you run Rubocop with auto-correct `rubocop -a thing.rb`\r\n\r\n3. It produces an error:\r\n  ```\r\n  Inspecting 1 file\r\n  E\r\n\r\n  Offenses:\r\n\r\n  thing.rb:2:21: C: [Corrected] Use %i or %I for an array of symbols.\r\n    do_anything only: [:word, :two] { 5 }\r\n                      ^^^^^^^^^^^^^\r\n  thing.rb:2:34: E: unexpected token tLCURLY\r\n  (Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)\r\n    do_anything only: %i[word two] { 5 }\r\n                                   ^\r\n\r\n  1 file inspected, 2 offenses detected, 1 offense corrected\r\n  ```\r\n\r\n## RuboCop version\r\n\r\n`0.48.1 (using Parser 2.4.0.0, running on ruby 2.2.4 x86_64-darwin16)`"},"comment":{"url":"https://api.github.com/repos/bbatsov/rubocop/issues/comments/307547690","html_url":"https://github.com/bbatsov/rubocop/issues/4481#issuecomment-307547690","issue_url":"https://api.github.com/repos/bbatsov/rubocop/issues/4481","id":307547690,"user":{"login":"pocke","id":4361134,"avatar_url":"https://avatars3.githubusercontent.com/u/4361134?v=3","gravatar_id":"","url":"https://api.github.com/users/pocke","html_url":"https://github.com/pocke","followers_url":"https://api.github.com/users/pocke/followers","following_url":"https://api.github.com/users/pocke/following{/other_user}","gists_url":"https://api.github.com/users/pocke/gists{/gist_id}","starred_url":"https://api.github.com/users/pocke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pocke/subscriptions","organizations_url":"https://api.github.com/users/pocke/orgs","repos_url":"https://api.github.com/users/pocke/repos","events_url":"https://api.github.com/users/pocke/events{/privacy}","received_events_url":"https://api.github.com/users/pocke/received_events","type":"User","site_admin":false},"created_at":"2017-06-10T07:02:37Z","updated_at":"2017-06-10T07:02:37Z","body":"The above code has same problem...\r\n\r\n\r\n```ruby\r\n# not error\r\nfoo [:foo, :bar] { something }\r\n\r\n# Syntax error\r\nfoo %i[foo bar] { something }\r\n```\r\n\r\nRef:\r\n\r\n- https://bacon-cannon.herokuapp.com/parmlinks/b3c1ffc5-347a-4389-8c62-87e0649df628\r\n- https://bacon-cannon.herokuapp.com/parmlinks/a3f72d53-4764-4c33-8cea-46cb4bda421c"}}
{"actor":{"display_login":"pocke"}}