{"action":"opened","issue":{"url":"https://api.github.com/repos/bbatsov/rubocop/issues/2658","labels_url":"https://api.github.com/repos/bbatsov/rubocop/issues/2658/labels{/name}","comments_url":"https://api.github.com/repos/bbatsov/rubocop/issues/2658/comments","events_url":"https://api.github.com/repos/bbatsov/rubocop/issues/2658/events","html_url":"https://github.com/bbatsov/rubocop/issues/2658","id":127129023,"number":2658,"title":"Style/MutableConstant causes undefined method `loc' for nil:NilClass","user":{"login":"aevernon","id":21786,"avatar_url":"https://avatars.githubusercontent.com/u/21786?v=3","gravatar_id":"","url":"https://api.github.com/users/aevernon","html_url":"https://github.com/aevernon","followers_url":"https://api.github.com/users/aevernon/followers","following_url":"https://api.github.com/users/aevernon/following{/other_user}","gists_url":"https://api.github.com/users/aevernon/gists{/gist_id}","starred_url":"https://api.github.com/users/aevernon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aevernon/subscriptions","organizations_url":"https://api.github.com/users/aevernon/orgs","repos_url":"https://api.github.com/users/aevernon/repos","events_url":"https://api.github.com/users/aevernon/events{/privacy}","received_events_url":"https://api.github.com/users/aevernon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-17T22:28:22Z","updated_at":"2016-01-17T22:28:22Z","closed_at":null,"body":"If I call `rubocop -d` on this code:\r\n\r\n```ruby\r\nFOO, BAR = call_func\r\n```\r\n\r\nI get this error:\r\n\r\n```\r\nFor /home/aev/test: configuration from /home/aev/.gem/ruby/gems/rubocop-0.36.0/config/default.yml\r\nInheriting configuration from /home/aev/.gem/ruby/gems/rubocop-0.36.0/config/enabled.yml\r\nInheriting configuration from /home/aev/.gem/ruby/gems/rubocop-0.36.0/config/disabled.yml\r\nInspecting 1 file\r\nScanning /home/aev/test/test.rb\r\nAn error occurred while Style/MutableConstant cop was inspecting /home/aev/test/test.rb.\r\nundefined method `loc' for nil:NilClass\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/cop/cop.rb:159:in `add_offense'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/cop/style/mutable_constant.rb:24:in `on_casgn'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/cop/commissioner.rb:38:in `block (2 levels) in on_casgn'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/cop/commissioner.rb:88:in `with_cop_error_handling'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/cop/commissioner.rb:37:in `block in on_casgn'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/cop/commissioner.rb:35:in `each'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/cop/commissioner.rb:35:in `on_casgn'\r\n/home/aev/.gem/ruby/gems/ast-2.2.0/lib/ast/processor/mixin.rb:259:in `process'\r\n/home/aev/.gem/ruby/gems/ast-2.2.0/lib/ast/processor/mixin.rb:276:in `block in process_all'\r\n/home/aev/.gem/ruby/gems/ast-2.2.0/lib/ast/processor/mixin.rb:275:in `map'\r\n/home/aev/.gem/ruby/gems/ast-2.2.0/lib/ast/processor/mixin.rb:275:in `process_all'\r\n/home/aev/.gem/ruby/gems/parser-2.3.0.1/lib/parser/ast/processor.rb:9:in `process_regular_node'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/cop/commissioner.rb:42:in `on_mlhs'\r\n/home/aev/.gem/ruby/gems/ast-2.2.0/lib/ast/processor/mixin.rb:259:in `process'\r\n/home/aev/.gem/ruby/gems/ast-2.2.0/lib/ast/processor/mixin.rb:276:in `block in process_all'\r\n/home/aev/.gem/ruby/gems/ast-2.2.0/lib/ast/processor/mixin.rb:275:in `map'\r\n/home/aev/.gem/ruby/gems/ast-2.2.0/lib/ast/processor/mixin.rb:275:in `process_all'\r\n/home/aev/.gem/ruby/gems/parser-2.3.0.1/lib/parser/ast/processor.rb:9:in `process_regular_node'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/cop/commissioner.rb:42:in `on_masgn'\r\n/home/aev/.gem/ruby/gems/ast-2.2.0/lib/ast/processor/mixin.rb:259:in `process'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/cop/commissioner.rb:54:in `investigate'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/cop/team.rb:37:in `inspect_file'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/runner.rb:194:in `inspect_file'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/runner.rb:164:in `block in do_inspection_loop'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/runner.rb:158:in `loop'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/runner.rb:158:in `do_inspection_loop'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/runner.rb:87:in `process_file'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/runner.rb:59:in `block in inspect_files'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/runner.rb:57:in `each'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/runner.rb:57:in `inspect_files'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/runner.rb:35:in `run'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/lib/rubocop/cli.rb:30:in `run'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/bin/rubocop:14:in `block in <top (required)>'\r\n/usr/share/ruby/benchmark.rb:303:in `realtime'\r\n/home/aev/.gem/ruby/gems/rubocop-0.36.0/bin/rubocop:13:in `<top (required)>'\r\n/home/aev/bin/rubocop:23:in `load'\r\n/home/aev/bin/rubocop:23:in `<main>'\r\n.\r\n\r\n1 file inspected, no offenses detected\r\n\r\n2 errors occurred:\r\nAn error occurred while Style/MutableConstant cop was inspecting /home/aev/test/test.rb.\r\nAn error occurred while Style/MutableConstant cop was inspecting /home/aev/test/test.rb.\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.36.0 (using Parser 2.3.0.1, running on ruby 2.2.4 x86_64-linux)\r\nFinished in 0.0753912889995263 seconds\r\n```"}}