{"action":"created","comment":{"url":"https://api.github.com/repos/bbatsov/rubocop/pulls/comments/99507012","pull_request_review_id":20185389,"id":99507012,"diff_hunk":"@@ -0,0 +1,75 @@\n+# frozen_string_literal: true\n+\n+module RuboCop\n+  module Cop\n+    module Style\n+      # This cop checks against comparing a variable with multiple items,\n+      # where `Array.include?` could be used instead to avoid DRY errors.","path":"lib/rubocop/cop/style/multiple_comparison.rb","position":7,"original_position":7,"commit_id":"76d4dca38a4c4b8d2e540f27e879992a66250e48","original_commit_id":"76d4dca38a4c4b8d2e540f27e879992a66250e48","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},"body":"DRY errors? I'd simply use the term \"code repetition\" here. \r\n\r\nTechnically speaking using `Set#include?` is even better, btw. Maybe this should be made configurable in respect to the message?\r\n\r\nArray.include? -> Array#includes?","created_at":"2017-02-06T01:30:09Z","updated_at":"2017-02-06T01:30:09Z","html_url":"https://github.com/bbatsov/rubocop/pull/4021#discussion_r99507012","pull_request_url":"https://api.github.com/repos/bbatsov/rubocop/pulls/4021","_links":{"self":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/comments/99507012"},"html":{"href":"https://github.com/bbatsov/rubocop/pull/4021#discussion_r99507012"},"pull_request":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/4021"}}},"pull_request":{"url":"https://api.github.com/repos/bbatsov/rubocop/pulls/4021","id":104698866,"html_url":"https://github.com/bbatsov/rubocop/pull/4021","diff_url":"https://github.com/bbatsov/rubocop/pull/4021.diff","patch_url":"https://github.com/bbatsov/rubocop/pull/4021.patch","issue_url":"https://api.github.com/repos/bbatsov/rubocop/issues/4021","number":4021,"state":"open","locked":false,"title":"Add new `Style/MultipleComparison` cop","user":{"login":"dabroz","id":179706,"avatar_url":"https://avatars.githubusercontent.com/u/179706?v=3","gravatar_id":"","url":"https://api.github.com/users/dabroz","html_url":"https://github.com/dabroz","followers_url":"https://api.github.com/users/dabroz/followers","following_url":"https://api.github.com/users/dabroz/following{/other_user}","gists_url":"https://api.github.com/users/dabroz/gists{/gist_id}","starred_url":"https://api.github.com/users/dabroz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dabroz/subscriptions","organizations_url":"https://api.github.com/users/dabroz/orgs","repos_url":"https://api.github.com/users/dabroz/repos","events_url":"https://api.github.com/users/dabroz/events{/privacy}","received_events_url":"https://api.github.com/users/dabroz/received_events","type":"User","site_admin":false},"body":"This cop checks against comparing a variable with multiple items,\r\nwhere `Array.include?` could be used instead to avoid DRY errors.\r\n\r\nExample:\r\n\r\n    # bad\r\n    if a == 'a' || a == 'b' || a == 'c'\r\n\r\n    # good\r\n    if ['a', 'b', 'c'].include? a\r\n\r\n-----------------\r\n\r\nBefore submitting the PR make sure the following are checked:\r\n\r\n* [x] Wrote [good commit messages][1].\r\n* [x] Used the same coding conventions as the rest of the project.\r\n* [x] Feature branch is up-to-date with `master` (if not - rebase it).\r\n* [x] Squashed related commits together.\r\n* [x] Added tests.\r\n* [x] Added an entry to the [Changelog](../blob/master/CHANGELOG.md) if the new code introduces user-observable changes. See [changelog entry format](../blob/master/CONTRIBUTING.md#changelog-entry-format).\r\n* [x] All tests are passing.\r\n* [x] The new code doesn't generate RuboCop offenses.\r\n* [x] The PR relates to *only* one subject with a clear title\r\n  and description in grammatically correct, complete sentences.\r\n* [x] Updated cop documentation with `rake generate_cops_documentation` (required only when you've added a new cop or changed the configuration/documentation of an existing cop).\r\n\r\n[1]: http://chris.beams.io/posts/git-commit/\r\n","created_at":"2017-02-05T13:01:19Z","updated_at":"2017-02-06T01:30:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"11470a31b23cb673f85b68b406013b368db48233","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/bbatsov/rubocop/pulls/4021/commits","review_comments_url":"https://api.github.com/repos/bbatsov/rubocop/pulls/4021/comments","review_comment_url":"https://api.github.com/repos/bbatsov/rubocop/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bbatsov/rubocop/issues/4021/comments","statuses_url":"https://api.github.com/repos/bbatsov/rubocop/statuses/76d4dca38a4c4b8d2e540f27e879992a66250e48","head":{"label":"dabroz:cop-multiple-comparisons","ref":"cop-multiple-comparisons","sha":"76d4dca38a4c4b8d2e540f27e879992a66250e48","user":{"login":"dabroz","id":179706,"avatar_url":"https://avatars.githubusercontent.com/u/179706?v=3","gravatar_id":"","url":"https://api.github.com/users/dabroz","html_url":"https://github.com/dabroz","followers_url":"https://api.github.com/users/dabroz/followers","following_url":"https://api.github.com/users/dabroz/following{/other_user}","gists_url":"https://api.github.com/users/dabroz/gists{/gist_id}","starred_url":"https://api.github.com/users/dabroz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dabroz/subscriptions","organizations_url":"https://api.github.com/users/dabroz/orgs","repos_url":"https://api.github.com/users/dabroz/repos","events_url":"https://api.github.com/users/dabroz/events{/privacy}","received_events_url":"https://api.github.com/users/dabroz/received_events","type":"User","site_admin":false},"repo":{"id":80987566,"name":"rubocop","full_name":"dabroz/rubocop","owner":{"login":"dabroz","id":179706,"avatar_url":"https://avatars.githubusercontent.com/u/179706?v=3","gravatar_id":"","url":"https://api.github.com/users/dabroz","html_url":"https://github.com/dabroz","followers_url":"https://api.github.com/users/dabroz/followers","following_url":"https://api.github.com/users/dabroz/following{/other_user}","gists_url":"https://api.github.com/users/dabroz/gists{/gist_id}","starred_url":"https://api.github.com/users/dabroz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dabroz/subscriptions","organizations_url":"https://api.github.com/users/dabroz/orgs","repos_url":"https://api.github.com/users/dabroz/repos","events_url":"https://api.github.com/users/dabroz/events{/privacy}","received_events_url":"https://api.github.com/users/dabroz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dabroz/rubocop","description":"A Ruby static code analyzer, based on the community Ruby style guide.","fork":true,"url":"https://api.github.com/repos/dabroz/rubocop","forks_url":"https://api.github.com/repos/dabroz/rubocop/forks","keys_url":"https://api.github.com/repos/dabroz/rubocop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dabroz/rubocop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dabroz/rubocop/teams","hooks_url":"https://api.github.com/repos/dabroz/rubocop/hooks","issue_events_url":"https://api.github.com/repos/dabroz/rubocop/issues/events{/number}","events_url":"https://api.github.com/repos/dabroz/rubocop/events","assignees_url":"https://api.github.com/repos/dabroz/rubocop/assignees{/user}","branches_url":"https://api.github.com/repos/dabroz/rubocop/branches{/branch}","tags_url":"https://api.github.com/repos/dabroz/rubocop/tags","blobs_url":"https://api.github.com/repos/dabroz/rubocop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dabroz/rubocop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dabroz/rubocop/git/refs{/sha}","trees_url":"https://api.github.com/repos/dabroz/rubocop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dabroz/rubocop/statuses/{sha}","languages_url":"https://api.github.com/repos/dabroz/rubocop/languages","stargazers_url":"https://api.github.com/repos/dabroz/rubocop/stargazers","contributors_url":"https://api.github.com/repos/dabroz/rubocop/contributors","subscribers_url":"https://api.github.com/repos/dabroz/rubocop/subscribers","subscription_url":"https://api.github.com/repos/dabroz/rubocop/subscription","commits_url":"https://api.github.com/repos/dabroz/rubocop/commits{/sha}","git_commits_url":"https://api.github.com/repos/dabroz/rubocop/git/commits{/sha}","comments_url":"https://api.github.com/repos/dabroz/rubocop/comments{/number}","issue_comment_url":"https://api.github.com/repos/dabroz/rubocop/issues/comments{/number}","contents_url":"https://api.github.com/repos/dabroz/rubocop/contents/{+path}","compare_url":"https://api.github.com/repos/dabroz/rubocop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dabroz/rubocop/merges","archive_url":"https://api.github.com/repos/dabroz/rubocop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dabroz/rubocop/downloads","issues_url":"https://api.github.com/repos/dabroz/rubocop/issues{/number}","pulls_url":"https://api.github.com/repos/dabroz/rubocop/pulls{/number}","milestones_url":"https://api.github.com/repos/dabroz/rubocop/milestones{/number}","notifications_url":"https://api.github.com/repos/dabroz/rubocop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dabroz/rubocop/labels{/name}","releases_url":"https://api.github.com/repos/dabroz/rubocop/releases{/id}","deployments_url":"https://api.github.com/repos/dabroz/rubocop/deployments","created_at":"2017-02-05T11:11:24Z","updated_at":"2017-02-05T11:11:28Z","pushed_at":"2017-02-05T20:09:50Z","git_url":"git://github.com/dabroz/rubocop.git","ssh_url":"git@github.com:dabroz/rubocop.git","clone_url":"https://github.com/dabroz/rubocop.git","svn_url":"https://github.com/dabroz/rubocop","homepage":"http://rubocop.readthedocs.io","size":14874,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bbatsov:master","ref":"master","sha":"713e6b9ad0b266cbdfad5ddc22bf9a5d05a43c8c","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},"repo":{"id":4095287,"name":"rubocop","full_name":"bbatsov/rubocop","owner":{"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},"private":false,"html_url":"https://github.com/bbatsov/rubocop","description":"A Ruby static code analyzer, based on the community Ruby style guide.","fork":false,"url":"https://api.github.com/repos/bbatsov/rubocop","forks_url":"https://api.github.com/repos/bbatsov/rubocop/forks","keys_url":"https://api.github.com/repos/bbatsov/rubocop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bbatsov/rubocop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bbatsov/rubocop/teams","hooks_url":"https://api.github.com/repos/bbatsov/rubocop/hooks","issue_events_url":"https://api.github.com/repos/bbatsov/rubocop/issues/events{/number}","events_url":"https://api.github.com/repos/bbatsov/rubocop/events","assignees_url":"https://api.github.com/repos/bbatsov/rubocop/assignees{/user}","branches_url":"https://api.github.com/repos/bbatsov/rubocop/branches{/branch}","tags_url":"https://api.github.com/repos/bbatsov/rubocop/tags","blobs_url":"https://api.github.com/repos/bbatsov/rubocop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bbatsov/rubocop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bbatsov/rubocop/git/refs{/sha}","trees_url":"https://api.github.com/repos/bbatsov/rubocop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bbatsov/rubocop/statuses/{sha}","languages_url":"https://api.github.com/repos/bbatsov/rubocop/languages","stargazers_url":"https://api.github.com/repos/bbatsov/rubocop/stargazers","contributors_url":"https://api.github.com/repos/bbatsov/rubocop/contributors","subscribers_url":"https://api.github.com/repos/bbatsov/rubocop/subscribers","subscription_url":"https://api.github.com/repos/bbatsov/rubocop/subscription","commits_url":"https://api.github.com/repos/bbatsov/rubocop/commits{/sha}","git_commits_url":"https://api.github.com/repos/bbatsov/rubocop/git/commits{/sha}","comments_url":"https://api.github.com/repos/bbatsov/rubocop/comments{/number}","issue_comment_url":"https://api.github.com/repos/bbatsov/rubocop/issues/comments{/number}","contents_url":"https://api.github.com/repos/bbatsov/rubocop/contents/{+path}","compare_url":"https://api.github.com/repos/bbatsov/rubocop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bbatsov/rubocop/merges","archive_url":"https://api.github.com/repos/bbatsov/rubocop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bbatsov/rubocop/downloads","issues_url":"https://api.github.com/repos/bbatsov/rubocop/issues{/number}","pulls_url":"https://api.github.com/repos/bbatsov/rubocop/pulls{/number}","milestones_url":"https://api.github.com/repos/bbatsov/rubocop/milestones{/number}","notifications_url":"https://api.github.com/repos/bbatsov/rubocop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bbatsov/rubocop/labels{/name}","releases_url":"https://api.github.com/repos/bbatsov/rubocop/releases{/id}","deployments_url":"https://api.github.com/repos/bbatsov/rubocop/deployments","created_at":"2012-04-21T10:09:58Z","updated_at":"2017-02-05T11:54:43Z","pushed_at":"2017-02-05T20:09:51Z","git_url":"git://github.com/bbatsov/rubocop.git","ssh_url":"git@github.com:bbatsov/rubocop.git","clone_url":"https://github.com/bbatsov/rubocop.git","svn_url":"https://github.com/bbatsov/rubocop","homepage":"http://rubocop.readthedocs.io","size":14966,"stargazers_count":7259,"watchers_count":7259,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1190,"mirror_url":null,"open_issues_count":179,"forks":1190,"open_issues":179,"watchers":7259,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/4021"},"html":{"href":"https://github.com/bbatsov/rubocop/pull/4021"},"issue":{"href":"https://api.github.com/repos/bbatsov/rubocop/issues/4021"},"comments":{"href":"https://api.github.com/repos/bbatsov/rubocop/issues/4021/comments"},"review_comments":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/4021/comments"},"review_comment":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/4021/commits"},"statuses":{"href":"https://api.github.com/repos/bbatsov/rubocop/statuses/76d4dca38a4c4b8d2e540f27e879992a66250e48"}}}}
{"actor":{"display_login":"bbatsov"}}