{"action":"created","comment":{"url":"https://api.github.com/repos/aergonaut/cody/pulls/comments/57278149","id":57278149,"diff_hunk":"@@ -0,0 +1,15 @@\n+class ReviewRuleFileMatch < ReviewRule\n+  validates :file_match, presence: true\n+\n+  def file_match_regex\n+    /#{self.file_match}/\n+  end\n+\n+  def matches?(pull_request_hash)\n+    github = Octokit::Client.new(access_token: ENV[\"CODY_GITHUB_ACCESS_TOKEN\"])\n+    files = github.pull_request_files(pull_request_hash[\"repository\"][\"full_name\"], pull_request_hash[\"number\"])\n+    filenames = files.map(&:filename)\n+\n+    filenames.any? { |filename| filename =~ self.file_match_regex }","path":"app/models/review_rule_file_match.rb","position":13,"original_position":13,"commit_id":"0f07d99ac8e1c7bfbfe16a1876e9cfd101287b0b","original_commit_id":"0f07d99ac8e1c7bfbfe16a1876e9cfd101287b0b","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Redundant `self` detected.","created_at":"2016-03-24T06:14:05Z","updated_at":"2016-03-24T06:14:05Z","html_url":"https://github.com/aergonaut/cody/pull/20#discussion_r57278149","pull_request_url":"https://api.github.com/repos/aergonaut/cody/pulls/20","_links":{"self":{"href":"https://api.github.com/repos/aergonaut/cody/pulls/comments/57278149"},"html":{"href":"https://github.com/aergonaut/cody/pull/20#discussion_r57278149"},"pull_request":{"href":"https://api.github.com/repos/aergonaut/cody/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/aergonaut/cody/pulls/20","id":63994059,"html_url":"https://github.com/aergonaut/cody/pull/20","diff_url":"https://github.com/aergonaut/cody/pull/20.diff","patch_url":"https://github.com/aergonaut/cody/pull/20.patch","issue_url":"https://api.github.com/repos/aergonaut/cody/issues/20","number":20,"state":"open","locked":false,"title":"Auto review rules","user":{"login":"aergonaut","id":284007,"avatar_url":"https://avatars.githubusercontent.com/u/284007?v=3","gravatar_id":"","url":"https://api.github.com/users/aergonaut","html_url":"https://github.com/aergonaut","followers_url":"https://api.github.com/users/aergonaut/followers","following_url":"https://api.github.com/users/aergonaut/following{/other_user}","gists_url":"https://api.github.com/users/aergonaut/gists{/gist_id}","starred_url":"https://api.github.com/users/aergonaut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aergonaut/subscriptions","organizations_url":"https://api.github.com/users/aergonaut/orgs","repos_url":"https://api.github.com/users/aergonaut/repos","events_url":"https://api.github.com/users/aergonaut/events{/privacy}","received_events_url":"https://api.github.com/users/aergonaut/received_events","type":"User","site_admin":false},"body":"Automatic assignment of reviewers based on review rules.\r\n\r\nA `ReviewRule` has a `reviewer` attribute as well as a `#matches?` method. Subclasses of `ReviewRule` provide specific implementations of `#matches?` as well as utilize other attributes to determine whether or not the `reviewer` should be added.\r\n\r\n`reviewer` can either be the name of a single GitHub user, or a GitHub Team ID. If the attribute is a Team ID, then a random user from that team will be chosen as the reviewer.\r\n\r\nRules have a limitation that they cannot add a reviewer who has already been added to the list of pending reviews (whether by another rule or manually). This seems like a reasonable choice because if a reviewer would have been added due to a review rule, presumably she would be already be keeping that concern in mind, and would take that concern into account when doing any review.\r\n\r\nRules being implemented in this pull request:\r\n\r\n* `ReviewRuleFileMatch` based on a regex that is tested against each file name in the PR\r\n* `ReviewRuleAlways` which always applies","created_at":"2016-03-24T06:13:54Z","updated_at":"2016-03-24T06:14:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aec6f34a3c9e81607b18af4c6007a150039c9e2a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aergonaut/cody/pulls/20/commits","review_comments_url":"https://api.github.com/repos/aergonaut/cody/pulls/20/comments","review_comment_url":"https://api.github.com/repos/aergonaut/cody/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aergonaut/cody/issues/20/comments","statuses_url":"https://api.github.com/repos/aergonaut/cody/statuses/0f07d99ac8e1c7bfbfe16a1876e9cfd101287b0b","head":{"label":"aergonaut:auto-review-rules","ref":"auto-review-rules","sha":"0f07d99ac8e1c7bfbfe16a1876e9cfd101287b0b","user":{"login":"aergonaut","id":284007,"avatar_url":"https://avatars.githubusercontent.com/u/284007?v=3","gravatar_id":"","url":"https://api.github.com/users/aergonaut","html_url":"https://github.com/aergonaut","followers_url":"https://api.github.com/users/aergonaut/followers","following_url":"https://api.github.com/users/aergonaut/following{/other_user}","gists_url":"https://api.github.com/users/aergonaut/gists{/gist_id}","starred_url":"https://api.github.com/users/aergonaut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aergonaut/subscriptions","organizations_url":"https://api.github.com/users/aergonaut/orgs","repos_url":"https://api.github.com/users/aergonaut/repos","events_url":"https://api.github.com/users/aergonaut/events{/privacy}","received_events_url":"https://api.github.com/users/aergonaut/received_events","type":"User","site_admin":false},"repo":{"id":48143718,"name":"cody","full_name":"aergonaut/cody","owner":{"login":"aergonaut","id":284007,"avatar_url":"https://avatars.githubusercontent.com/u/284007?v=3","gravatar_id":"","url":"https://api.github.com/users/aergonaut","html_url":"https://github.com/aergonaut","followers_url":"https://api.github.com/users/aergonaut/followers","following_url":"https://api.github.com/users/aergonaut/following{/other_user}","gists_url":"https://api.github.com/users/aergonaut/gists{/gist_id}","starred_url":"https://api.github.com/users/aergonaut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aergonaut/subscriptions","organizations_url":"https://api.github.com/users/aergonaut/orgs","repos_url":"https://api.github.com/users/aergonaut/repos","events_url":"https://api.github.com/users/aergonaut/events{/privacy}","received_events_url":"https://api.github.com/users/aergonaut/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aergonaut/cody","description":"Your friendly neighborhood code review bot","fork":false,"url":"https://api.github.com/repos/aergonaut/cody","forks_url":"https://api.github.com/repos/aergonaut/cody/forks","keys_url":"https://api.github.com/repos/aergonaut/cody/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aergonaut/cody/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aergonaut/cody/teams","hooks_url":"https://api.github.com/repos/aergonaut/cody/hooks","issue_events_url":"https://api.github.com/repos/aergonaut/cody/issues/events{/number}","events_url":"https://api.github.com/repos/aergonaut/cody/events","assignees_url":"https://api.github.com/repos/aergonaut/cody/assignees{/user}","branches_url":"https://api.github.com/repos/aergonaut/cody/branches{/branch}","tags_url":"https://api.github.com/repos/aergonaut/cody/tags","blobs_url":"https://api.github.com/repos/aergonaut/cody/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aergonaut/cody/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aergonaut/cody/git/refs{/sha}","trees_url":"https://api.github.com/repos/aergonaut/cody/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aergonaut/cody/statuses/{sha}","languages_url":"https://api.github.com/repos/aergonaut/cody/languages","stargazers_url":"https://api.github.com/repos/aergonaut/cody/stargazers","contributors_url":"https://api.github.com/repos/aergonaut/cody/contributors","subscribers_url":"https://api.github.com/repos/aergonaut/cody/subscribers","subscription_url":"https://api.github.com/repos/aergonaut/cody/subscription","commits_url":"https://api.github.com/repos/aergonaut/cody/commits{/sha}","git_commits_url":"https://api.github.com/repos/aergonaut/cody/git/commits{/sha}","comments_url":"https://api.github.com/repos/aergonaut/cody/comments{/number}","issue_comment_url":"https://api.github.com/repos/aergonaut/cody/issues/comments{/number}","contents_url":"https://api.github.com/repos/aergonaut/cody/contents/{+path}","compare_url":"https://api.github.com/repos/aergonaut/cody/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aergonaut/cody/merges","archive_url":"https://api.github.com/repos/aergonaut/cody/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aergonaut/cody/downloads","issues_url":"https://api.github.com/repos/aergonaut/cody/issues{/number}","pulls_url":"https://api.github.com/repos/aergonaut/cody/pulls{/number}","milestones_url":"https://api.github.com/repos/aergonaut/cody/milestones{/number}","notifications_url":"https://api.github.com/repos/aergonaut/cody/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aergonaut/cody/labels{/name}","releases_url":"https://api.github.com/repos/aergonaut/cody/releases{/id}","deployments_url":"https://api.github.com/repos/aergonaut/cody/deployments","created_at":"2015-12-17T00:53:40Z","updated_at":"2016-01-11T23:36:14Z","pushed_at":"2016-03-24T06:13:54Z","git_url":"git://github.com/aergonaut/cody.git","ssh_url":"git@github.com:aergonaut/cody.git","clone_url":"https://github.com/aergonaut/cody.git","svn_url":"https://github.com/aergonaut/cody","homepage":"","size":104,"stargazers_count":8,"watchers_count":8,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":7,"forks":7,"open_issues":7,"watchers":8,"default_branch":"master"}},"base":{"label":"aergonaut:master","ref":"master","sha":"7f56355723bf1785919ea417883416a3ff841c38","user":{"login":"aergonaut","id":284007,"avatar_url":"https://avatars.githubusercontent.com/u/284007?v=3","gravatar_id":"","url":"https://api.github.com/users/aergonaut","html_url":"https://github.com/aergonaut","followers_url":"https://api.github.com/users/aergonaut/followers","following_url":"https://api.github.com/users/aergonaut/following{/other_user}","gists_url":"https://api.github.com/users/aergonaut/gists{/gist_id}","starred_url":"https://api.github.com/users/aergonaut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aergonaut/subscriptions","organizations_url":"https://api.github.com/users/aergonaut/orgs","repos_url":"https://api.github.com/users/aergonaut/repos","events_url":"https://api.github.com/users/aergonaut/events{/privacy}","received_events_url":"https://api.github.com/users/aergonaut/received_events","type":"User","site_admin":false},"repo":{"id":48143718,"name":"cody","full_name":"aergonaut/cody","owner":{"login":"aergonaut","id":284007,"avatar_url":"https://avatars.githubusercontent.com/u/284007?v=3","gravatar_id":"","url":"https://api.github.com/users/aergonaut","html_url":"https://github.com/aergonaut","followers_url":"https://api.github.com/users/aergonaut/followers","following_url":"https://api.github.com/users/aergonaut/following{/other_user}","gists_url":"https://api.github.com/users/aergonaut/gists{/gist_id}","starred_url":"https://api.github.com/users/aergonaut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aergonaut/subscriptions","organizations_url":"https://api.github.com/users/aergonaut/orgs","repos_url":"https://api.github.com/users/aergonaut/repos","events_url":"https://api.github.com/users/aergonaut/events{/privacy}","received_events_url":"https://api.github.com/users/aergonaut/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aergonaut/cody","description":"Your friendly neighborhood code review bot","fork":false,"url":"https://api.github.com/repos/aergonaut/cody","forks_url":"https://api.github.com/repos/aergonaut/cody/forks","keys_url":"https://api.github.com/repos/aergonaut/cody/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aergonaut/cody/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aergonaut/cody/teams","hooks_url":"https://api.github.com/repos/aergonaut/cody/hooks","issue_events_url":"https://api.github.com/repos/aergonaut/cody/issues/events{/number}","events_url":"https://api.github.com/repos/aergonaut/cody/events","assignees_url":"https://api.github.com/repos/aergonaut/cody/assignees{/user}","branches_url":"https://api.github.com/repos/aergonaut/cody/branches{/branch}","tags_url":"https://api.github.com/repos/aergonaut/cody/tags","blobs_url":"https://api.github.com/repos/aergonaut/cody/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aergonaut/cody/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aergonaut/cody/git/refs{/sha}","trees_url":"https://api.github.com/repos/aergonaut/cody/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aergonaut/cody/statuses/{sha}","languages_url":"https://api.github.com/repos/aergonaut/cody/languages","stargazers_url":"https://api.github.com/repos/aergonaut/cody/stargazers","contributors_url":"https://api.github.com/repos/aergonaut/cody/contributors","subscribers_url":"https://api.github.com/repos/aergonaut/cody/subscribers","subscription_url":"https://api.github.com/repos/aergonaut/cody/subscription","commits_url":"https://api.github.com/repos/aergonaut/cody/commits{/sha}","git_commits_url":"https://api.github.com/repos/aergonaut/cody/git/commits{/sha}","comments_url":"https://api.github.com/repos/aergonaut/cody/comments{/number}","issue_comment_url":"https://api.github.com/repos/aergonaut/cody/issues/comments{/number}","contents_url":"https://api.github.com/repos/aergonaut/cody/contents/{+path}","compare_url":"https://api.github.com/repos/aergonaut/cody/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aergonaut/cody/merges","archive_url":"https://api.github.com/repos/aergonaut/cody/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aergonaut/cody/downloads","issues_url":"https://api.github.com/repos/aergonaut/cody/issues{/number}","pulls_url":"https://api.github.com/repos/aergonaut/cody/pulls{/number}","milestones_url":"https://api.github.com/repos/aergonaut/cody/milestones{/number}","notifications_url":"https://api.github.com/repos/aergonaut/cody/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aergonaut/cody/labels{/name}","releases_url":"https://api.github.com/repos/aergonaut/cody/releases{/id}","deployments_url":"https://api.github.com/repos/aergonaut/cody/deployments","created_at":"2015-12-17T00:53:40Z","updated_at":"2016-01-11T23:36:14Z","pushed_at":"2016-03-24T06:13:54Z","git_url":"git://github.com/aergonaut/cody.git","ssh_url":"git@github.com:aergonaut/cody.git","clone_url":"https://github.com/aergonaut/cody.git","svn_url":"https://github.com/aergonaut/cody","homepage":"","size":104,"stargazers_count":8,"watchers_count":8,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":7,"forks":7,"open_issues":7,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/aergonaut/cody/pulls/20"},"html":{"href":"https://github.com/aergonaut/cody/pull/20"},"issue":{"href":"https://api.github.com/repos/aergonaut/cody/issues/20"},"comments":{"href":"https://api.github.com/repos/aergonaut/cody/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/aergonaut/cody/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/aergonaut/cody/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aergonaut/cody/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/aergonaut/cody/statuses/0f07d99ac8e1c7bfbfe16a1876e9cfd101287b0b"}}}}