{"action":"created","issue":{"url":"https://api.github.com/repos/bbatsov/rubocop/issues/1877","labels_url":"https://api.github.com/repos/bbatsov/rubocop/issues/1877/labels{/name}","comments_url":"https://api.github.com/repos/bbatsov/rubocop/issues/1877/comments","events_url":"https://api.github.com/repos/bbatsov/rubocop/issues/1877/events","html_url":"https://github.com/bbatsov/rubocop/pull/1877","id":74279041,"number":1877,"title":"[Fix #1865] Identify unnecessary rubocop:disable comments","user":{"login":"jonas054","id":336720,"avatar_url":"https://avatars.githubusercontent.com/u/336720?v=3","gravatar_id":"","url":"https://api.github.com/users/jonas054","html_url":"https://github.com/jonas054","followers_url":"https://api.github.com/users/jonas054/followers","following_url":"https://api.github.com/users/jonas054/following{/other_user}","gists_url":"https://api.github.com/users/jonas054/gists{/gist_id}","starred_url":"https://api.github.com/users/jonas054/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonas054/subscriptions","organizations_url":"https://api.github.com/users/jonas054/orgs","repos_url":"https://api.github.com/users/jonas054/repos","events_url":"https://api.github.com/users/jonas054/events{/privacy}","received_events_url":"https://api.github.com/users/jonas054/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-08T08:17:16Z","updated_at":"2015-05-09T07:36:01Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/bbatsov/rubocop/pulls/1877","html_url":"https://github.com/bbatsov/rubocop/pull/1877","diff_url":"https://github.com/bbatsov/rubocop/pull/1877.diff","patch_url":"https://github.com/bbatsov/rubocop/pull/1877.patch"},"body":"*I think I found a way to add this functionality, not mess up the code badly, and keep public APIs backwards compatible.*\r\n\r\nKeep all offenses around, including locally disabled ones, until reporting time.\r\n\r\nLet the formatters do the filtering by adding a new method `wanted_offenses` in the public API of `BaseFormatter`. The default behavior is to not keep the comment-disabled offenses, which makes the change backwards compatible.\r\n\r\nLikewise, the public API of `Offense` is amended with a `disabled?` method, but the `corrected`/`corrected?` methods stay compatible.\r\n\r\n`DisabledLinesFormatter` outputs a red `(unnecessary)` after lines with a disabled cop and a line range that didn't have any offenses for that cop."},"comment":{"url":"https://api.github.com/repos/bbatsov/rubocop/issues/comments/100441579","html_url":"https://github.com/bbatsov/rubocop/pull/1877#issuecomment-100441579","issue_url":"https://api.github.com/repos/bbatsov/rubocop/issues/1877","id":100441579,"user":{"login":"bbatsov","id":103882,"avatar_url":"https://avatars.githubusercontent.com/u/103882?v=3","gravatar_id":"","url":"https://api.github.com/users/bbatsov","html_url":"https://github.com/bbatsov","followers_url":"https://api.github.com/users/bbatsov/followers","following_url":"https://api.github.com/users/bbatsov/following{/other_user}","gists_url":"https://api.github.com/users/bbatsov/gists{/gist_id}","starred_url":"https://api.github.com/users/bbatsov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbatsov/subscriptions","organizations_url":"https://api.github.com/users/bbatsov/orgs","repos_url":"https://api.github.com/users/bbatsov/repos","events_url":"https://api.github.com/users/bbatsov/events{/privacy}","received_events_url":"https://api.github.com/users/bbatsov/received_events","type":"User","site_admin":false},"created_at":"2015-05-09T07:36:01Z","updated_at":"2015-05-09T07:36:01Z","body":"Haven't really had a chance to go over this. I don't like that much the idea of making this another formatter. Isn't it more sensible to always report about such redundant comments? I have a feeling pretty much no one will realise there is `-format d`."}}