{"action":"created","issue":{"url":"https://api.github.com/repos/bbatsov/rubocop/issues/3185","repository_url":"https://api.github.com/repos/bbatsov/rubocop","labels_url":"https://api.github.com/repos/bbatsov/rubocop/issues/3185/labels{/name}","comments_url":"https://api.github.com/repos/bbatsov/rubocop/issues/3185/comments","events_url":"https://api.github.com/repos/bbatsov/rubocop/issues/3185/events","html_url":"https://github.com/bbatsov/rubocop/issues/3185","id":157713770,"number":3185,"title":"Falsy Lint/UnusedMethodArgument for specific Ruby 2.3 lonely operator usage","user":{"login":"gsamokovarov","id":604618,"avatar_url":"https://avatars.githubusercontent.com/u/604618?v=3","gravatar_id":"","url":"https://api.github.com/users/gsamokovarov","html_url":"https://github.com/gsamokovarov","followers_url":"https://api.github.com/users/gsamokovarov/followers","following_url":"https://api.github.com/users/gsamokovarov/following{/other_user}","gists_url":"https://api.github.com/users/gsamokovarov/gists{/gist_id}","starred_url":"https://api.github.com/users/gsamokovarov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gsamokovarov/subscriptions","organizations_url":"https://api.github.com/users/gsamokovarov/orgs","repos_url":"https://api.github.com/users/gsamokovarov/repos","events_url":"https://api.github.com/users/gsamokovarov/events{/privacy}","received_events_url":"https://api.github.com/users/gsamokovarov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-05-31T16:24:51Z","updated_at":"2016-06-01T06:48:58Z","closed_at":null,"body":"## Expected behavior\r\n\r\nGiven the following code below that uses the Ruby 2.3 lonely operator I get a complaint about an unused argument.\r\n\r\n```ruby\r\ndef self.some_method(bar:)\r\n  something&.some_method(bar) { something_else }\r\nend\r\n```\r\n\r\n```\r\nW: Unused method argument - bar\r\n```\r\n\r\nNote that it only fails to detect the keyword argument usage if a block is given.\r\n\r\n```ruby\r\ndef self.some_method(bar:)\r\n  something&.some_method(bar)\r\nend\r\n```\r\n\r\nThe example above doesn't receive a warning from Rubocop.\r\n\r\n## Actual behavior\r\n\r\nDon't give unused argument warnings as the arguments are actually used.\r\n\r\n## Steps to reproduce the problem\r\n\r\nCheck out the code snippets above or the patch below.\r\n\r\n```patch\r\ndiff --git i/spec/rubocop/cop/lint/unused_method_argument_spec.rb w/spec/rubocop/cop/lint/unused_method_argument_spec.rb\r\nindex 38f1bf3..48e6203 100644\r\n--- i/spec/rubocop/cop/lint/unused_method_argument_spec.rb\r\n+++ w/spec/rubocop/cop/lint/unused_method_argument_spec.rb\r\n@@ -69,6 +69,18 @@ describe RuboCop::Cop::Lint::UnusedMethodArgument, :config do\r\n       end\r\n     end\r\n \r\n+    context 'when a required keyword argument is used in lonely operator', ruby: 2.3 do\r\n+      let(:source) { <<-END }\r\n+        def self.some_method(bar:)\r\n+          something&.some_method(bar) { something_else }\r\n+        end\r\n+      END\r\n+\r\n+      it 'accepts' do\r\n+        expect(cop.offenses).to be_empty\r\n+      end\r\n+    end\r\n+\r\n     context 'when an optional keyword argument is unused', ruby: 2 do\r\n       let(:source) { <<-END }\r\n         def self.some_method(foo, bar: 1)\r\n```\r\n\r\n## RuboCop version\r\n\r\n```\r\n$ rubocop -V\r\n0.40.0 (using Parser 2.3.1.0, running on ruby 2.3.1 x86_64-darwin15)\r\n```"},"comment":{"url":"https://api.github.com/repos/bbatsov/rubocop/issues/comments/222907731","html_url":"https://github.com/bbatsov/rubocop/issues/3185#issuecomment-222907731","issue_url":"https://api.github.com/repos/bbatsov/rubocop/issues/3185","id":222907731,"user":{"login":"alexdowad","id":1067359,"avatar_url":"https://avatars.githubusercontent.com/u/1067359?v=3","gravatar_id":"","url":"https://api.github.com/users/alexdowad","html_url":"https://github.com/alexdowad","followers_url":"https://api.github.com/users/alexdowad/followers","following_url":"https://api.github.com/users/alexdowad/following{/other_user}","gists_url":"https://api.github.com/users/alexdowad/gists{/gist_id}","starred_url":"https://api.github.com/users/alexdowad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexdowad/subscriptions","organizations_url":"https://api.github.com/users/alexdowad/orgs","repos_url":"https://api.github.com/users/alexdowad/repos","events_url":"https://api.github.com/users/alexdowad/events{/privacy}","received_events_url":"https://api.github.com/users/alexdowad/received_events","type":"User","site_admin":false},"created_at":"2016-06-01T06:48:58Z","updated_at":"2016-06-01T06:48:58Z","body":"Thank you, sir!"}}
{"actor":{"display_login":"alexdowad"}}