{"action":"created","comment":{"url":"https://api.github.com/repos/troessner/reek/pulls/comments/24235907","id":24235907,"diff_hunk":"@@ -15,25 +15,53 @@ def matches?(actual)\n       def matches_examiner?(examiner)\n         @examiner = examiner\n         @warnings = @examiner.smells\n-        @warnings.length == 1 && @warnings[0].matches?(@klass, @patterns)\n+        return false unless @warnings.length == 1\n+        @warning = @warnings[0]\n+        no_smell_details_given? ? match_without_smell_details? : match_with_smell_details?\n       end\n \n       def failure_message\n         rpt = Cli::Report::Formatter.format_list(@warnings)\n-        \"Expected #{@examiner.description} to reek only of #{@klass}, but got:\\n#{rpt}\"\n+        \"Expected #{@examiner.description} to reek only of #{@smell_category}, but got:\\n#{rpt}\"\n       end\n \n       def failure_message_when_negated\n-        \"Expected #{@examiner.description} not to reek only of #{@klass}, but it did\"\n+        \"Expected #{@examiner.description} not to reek only of #{@smell_category}, but it did\"\n+      end\n+\n+      private\n+\n+      def match_without_smell_details?\n+        @warning.matches?(@smell_category)\n+      end\n+\n+      def match_with_smell_details?\n+        @smell_details_list.map do |smell_detail|\n+          @warning.matches?(@smell_category, smell_detail)\n+        end.all?\n       end\n     end\n \n     #\n-    # As for reek_of, but the matched smell warning must be the only warning of\n-    # any kind in the target source code's Reek report.\n+    # Checks the target source code for instances of +smell_category+,\n+    # and returns +true+ only if it can find one and only one of them that matches.\n+    # Additionally you can be more specific and pass in a list of \"smell_details\" you\n+    # want to check for as well e.g. \"name\" or \"count\" (see the examples below).\n+    #\n+    # smell_category - The smell category we check for\n+    # smells_details_list - An AoH with each hash containing smell_warning parameters\n+    #\n+    # Examples\n+    #\n+    #   reek_only_of(UncommunicativeParameterName, name: 'x2')\n+    #   reek_only_of(DataClump, count: 3)\n+    #\n+    # Examples from a real spec\n+    #\n+    #   expect(src).to reek_only_of(:TooManyStatements,  count: 6)\n     #\n-    def reek_only_of(smell_category, *patterns)\n-      ShouldReekOnlyOf.new(smell_category, patterns)\n+    def reek_only_of(smell_category, *smell_details_list)","path":"lib/reek/spec/should_reek_only_of.rb","position":65,"original_position":65,"commit_id":"56057e1202ed8a1792dcb8bd856493a6ebfe95b9","original_commit_id":"35e3f1c7f7c034556a423177ab30afbe1a70a87f","user":{"login":"mvz","id":10898,"avatar_url":"https://avatars.githubusercontent.com/u/10898?v=3","gravatar_id":"","url":"https://api.github.com/users/mvz","html_url":"https://github.com/mvz","followers_url":"https://api.github.com/users/mvz/followers","following_url":"https://api.github.com/users/mvz/following{/other_user}","gists_url":"https://api.github.com/users/mvz/gists{/gist_id}","starred_url":"https://api.github.com/users/mvz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvz/subscriptions","organizations_url":"https://api.github.com/users/mvz/orgs","repos_url":"https://api.github.com/users/mvz/repos","events_url":"https://api.github.com/users/mvz/events{/privacy}","received_events_url":"https://api.github.com/users/mvz/received_events","type":"User","site_admin":false},"body":"I'm still confused. Your doc says we expect exactly one warning. If that's the case, we don't need an AoH for the smell details, we just need a Hash.","created_at":"2015-02-06T11:47:34Z","updated_at":"2015-02-06T11:47:34Z","html_url":"https://github.com/troessner/reek/pull/371#discussion_r24235907","pull_request_url":"https://api.github.com/repos/troessner/reek/pulls/371","_links":{"self":{"href":"https://api.github.com/repos/troessner/reek/pulls/comments/24235907"},"html":{"href":"https://github.com/troessner/reek/pull/371#discussion_r24235907"},"pull_request":{"href":"https://api.github.com/repos/troessner/reek/pulls/371"}}},"pull_request":{"url":"https://api.github.com/repos/troessner/reek/pulls/371","id":27569549,"html_url":"https://github.com/troessner/reek/pull/371","diff_url":"https://github.com/troessner/reek/pull/371.diff","patch_url":"https://github.com/troessner/reek/pull/371.patch","issue_url":"https://api.github.com/repos/troessner/reek/issues/371","number":371,"state":"open","locked":false,"title":"Replace \"smell_of\" with \"reek_of\".","user":{"login":"troessner","id":271109,"avatar_url":"https://avatars.githubusercontent.com/u/271109?v=3","gravatar_id":"","url":"https://api.github.com/users/troessner","html_url":"https://github.com/troessner","followers_url":"https://api.github.com/users/troessner/followers","following_url":"https://api.github.com/users/troessner/following{/other_user}","gists_url":"https://api.github.com/users/troessner/gists{/gist_id}","starred_url":"https://api.github.com/users/troessner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/troessner/subscriptions","organizations_url":"https://api.github.com/users/troessner/orgs","repos_url":"https://api.github.com/users/troessner/repos","events_url":"https://api.github.com/users/troessner/events{/privacy}","received_events_url":"https://api.github.com/users/troessner/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-01-18T10:32:32Z","updated_at":"2015-02-06T11:47:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fa3f39e060849932c0726dba2aec6ec06fc469ff","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/troessner/reek/pulls/371/commits","review_comments_url":"https://api.github.com/repos/troessner/reek/pulls/371/comments","review_comment_url":"https://api.github.com/repos/troessner/reek/pulls/comments/{number}","comments_url":"https://api.github.com/repos/troessner/reek/issues/371/comments","statuses_url":"https://api.github.com/repos/troessner/reek/statuses/56057e1202ed8a1792dcb8bd856493a6ebfe95b9","head":{"label":"troessner:replace-smell-of-with-reek-of","ref":"replace-smell-of-with-reek-of","sha":"56057e1202ed8a1792dcb8bd856493a6ebfe95b9","user":{"login":"troessner","id":271109,"avatar_url":"https://avatars.githubusercontent.com/u/271109?v=3","gravatar_id":"","url":"https://api.github.com/users/troessner","html_url":"https://github.com/troessner","followers_url":"https://api.github.com/users/troessner/followers","following_url":"https://api.github.com/users/troessner/following{/other_user}","gists_url":"https://api.github.com/users/troessner/gists{/gist_id}","starred_url":"https://api.github.com/users/troessner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/troessner/subscriptions","organizations_url":"https://api.github.com/users/troessner/orgs","repos_url":"https://api.github.com/users/troessner/repos","events_url":"https://api.github.com/users/troessner/events{/privacy}","received_events_url":"https://api.github.com/users/troessner/received_events","type":"User","site_admin":false},"repo":{"id":49515,"name":"reek","full_name":"troessner/reek","owner":{"login":"troessner","id":271109,"avatar_url":"https://avatars.githubusercontent.com/u/271109?v=3","gravatar_id":"","url":"https://api.github.com/users/troessner","html_url":"https://github.com/troessner","followers_url":"https://api.github.com/users/troessner/followers","following_url":"https://api.github.com/users/troessner/following{/other_user}","gists_url":"https://api.github.com/users/troessner/gists{/gist_id}","starred_url":"https://api.github.com/users/troessner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/troessner/subscriptions","organizations_url":"https://api.github.com/users/troessner/orgs","repos_url":"https://api.github.com/users/troessner/repos","events_url":"https://api.github.com/users/troessner/events{/privacy}","received_events_url":"https://api.github.com/users/troessner/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/troessner/reek","description":"Code smell detector for Ruby","fork":false,"url":"https://api.github.com/repos/troessner/reek","forks_url":"https://api.github.com/repos/troessner/reek/forks","keys_url":"https://api.github.com/repos/troessner/reek/keys{/key_id}","collaborators_url":"https://api.github.com/repos/troessner/reek/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/troessner/reek/teams","hooks_url":"https://api.github.com/repos/troessner/reek/hooks","issue_events_url":"https://api.github.com/repos/troessner/reek/issues/events{/number}","events_url":"https://api.github.com/repos/troessner/reek/events","assignees_url":"https://api.github.com/repos/troessner/reek/assignees{/user}","branches_url":"https://api.github.com/repos/troessner/reek/branches{/branch}","tags_url":"https://api.github.com/repos/troessner/reek/tags","blobs_url":"https://api.github.com/repos/troessner/reek/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/troessner/reek/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/troessner/reek/git/refs{/sha}","trees_url":"https://api.github.com/repos/troessner/reek/git/trees{/sha}","statuses_url":"https://api.github.com/repos/troessner/reek/statuses/{sha}","languages_url":"https://api.github.com/repos/troessner/reek/languages","stargazers_url":"https://api.github.com/repos/troessner/reek/stargazers","contributors_url":"https://api.github.com/repos/troessner/reek/contributors","subscribers_url":"https://api.github.com/repos/troessner/reek/subscribers","subscription_url":"https://api.github.com/repos/troessner/reek/subscription","commits_url":"https://api.github.com/repos/troessner/reek/commits{/sha}","git_commits_url":"https://api.github.com/repos/troessner/reek/git/commits{/sha}","comments_url":"https://api.github.com/repos/troessner/reek/comments{/number}","issue_comment_url":"https://api.github.com/repos/troessner/reek/issues/comments/{number}","contents_url":"https://api.github.com/repos/troessner/reek/contents/{+path}","compare_url":"https://api.github.com/repos/troessner/reek/compare/{base}...{head}","merges_url":"https://api.github.com/repos/troessner/reek/merges","archive_url":"https://api.github.com/repos/troessner/reek/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/troessner/reek/downloads","issues_url":"https://api.github.com/repos/troessner/reek/issues{/number}","pulls_url":"https://api.github.com/repos/troessner/reek/pulls{/number}","milestones_url":"https://api.github.com/repos/troessner/reek/milestones{/number}","notifications_url":"https://api.github.com/repos/troessner/reek/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/troessner/reek/labels{/name}","releases_url":"https://api.github.com/repos/troessner/reek/releases{/id}","created_at":"2008-09-05T10:48:33Z","updated_at":"2015-02-06T10:06:44Z","pushed_at":"2015-02-06T08:15:15Z","git_url":"git://github.com/troessner/reek.git","ssh_url":"git@github.com:troessner/reek.git","clone_url":"https://github.com/troessner/reek.git","svn_url":"https://github.com/troessner/reek","homepage":"https://github.com/troessner/reek/wiki","size":5899,"stargazers_count":1199,"watchers_count":1199,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":80,"mirror_url":null,"open_issues_count":19,"forks":80,"open_issues":19,"watchers":1199,"default_branch":"master"}},"base":{"label":"troessner:master","ref":"master","sha":"00b77d4810e3e9d8b96caa953c561d21059183c4","user":{"login":"troessner","id":271109,"avatar_url":"https://avatars.githubusercontent.com/u/271109?v=3","gravatar_id":"","url":"https://api.github.com/users/troessner","html_url":"https://github.com/troessner","followers_url":"https://api.github.com/users/troessner/followers","following_url":"https://api.github.com/users/troessner/following{/other_user}","gists_url":"https://api.github.com/users/troessner/gists{/gist_id}","starred_url":"https://api.github.com/users/troessner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/troessner/subscriptions","organizations_url":"https://api.github.com/users/troessner/orgs","repos_url":"https://api.github.com/users/troessner/repos","events_url":"https://api.github.com/users/troessner/events{/privacy}","received_events_url":"https://api.github.com/users/troessner/received_events","type":"User","site_admin":false},"repo":{"id":49515,"name":"reek","full_name":"troessner/reek","owner":{"login":"troessner","id":271109,"avatar_url":"https://avatars.githubusercontent.com/u/271109?v=3","gravatar_id":"","url":"https://api.github.com/users/troessner","html_url":"https://github.com/troessner","followers_url":"https://api.github.com/users/troessner/followers","following_url":"https://api.github.com/users/troessner/following{/other_user}","gists_url":"https://api.github.com/users/troessner/gists{/gist_id}","starred_url":"https://api.github.com/users/troessner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/troessner/subscriptions","organizations_url":"https://api.github.com/users/troessner/orgs","repos_url":"https://api.github.com/users/troessner/repos","events_url":"https://api.github.com/users/troessner/events{/privacy}","received_events_url":"https://api.github.com/users/troessner/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/troessner/reek","description":"Code smell detector for Ruby","fork":false,"url":"https://api.github.com/repos/troessner/reek","forks_url":"https://api.github.com/repos/troessner/reek/forks","keys_url":"https://api.github.com/repos/troessner/reek/keys{/key_id}","collaborators_url":"https://api.github.com/repos/troessner/reek/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/troessner/reek/teams","hooks_url":"https://api.github.com/repos/troessner/reek/hooks","issue_events_url":"https://api.github.com/repos/troessner/reek/issues/events{/number}","events_url":"https://api.github.com/repos/troessner/reek/events","assignees_url":"https://api.github.com/repos/troessner/reek/assignees{/user}","branches_url":"https://api.github.com/repos/troessner/reek/branches{/branch}","tags_url":"https://api.github.com/repos/troessner/reek/tags","blobs_url":"https://api.github.com/repos/troessner/reek/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/troessner/reek/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/troessner/reek/git/refs{/sha}","trees_url":"https://api.github.com/repos/troessner/reek/git/trees{/sha}","statuses_url":"https://api.github.com/repos/troessner/reek/statuses/{sha}","languages_url":"https://api.github.com/repos/troessner/reek/languages","stargazers_url":"https://api.github.com/repos/troessner/reek/stargazers","contributors_url":"https://api.github.com/repos/troessner/reek/contributors","subscribers_url":"https://api.github.com/repos/troessner/reek/subscribers","subscription_url":"https://api.github.com/repos/troessner/reek/subscription","commits_url":"https://api.github.com/repos/troessner/reek/commits{/sha}","git_commits_url":"https://api.github.com/repos/troessner/reek/git/commits{/sha}","comments_url":"https://api.github.com/repos/troessner/reek/comments{/number}","issue_comment_url":"https://api.github.com/repos/troessner/reek/issues/comments/{number}","contents_url":"https://api.github.com/repos/troessner/reek/contents/{+path}","compare_url":"https://api.github.com/repos/troessner/reek/compare/{base}...{head}","merges_url":"https://api.github.com/repos/troessner/reek/merges","archive_url":"https://api.github.com/repos/troessner/reek/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/troessner/reek/downloads","issues_url":"https://api.github.com/repos/troessner/reek/issues{/number}","pulls_url":"https://api.github.com/repos/troessner/reek/pulls{/number}","milestones_url":"https://api.github.com/repos/troessner/reek/milestones{/number}","notifications_url":"https://api.github.com/repos/troessner/reek/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/troessner/reek/labels{/name}","releases_url":"https://api.github.com/repos/troessner/reek/releases{/id}","created_at":"2008-09-05T10:48:33Z","updated_at":"2015-02-06T10:06:44Z","pushed_at":"2015-02-06T08:15:15Z","git_url":"git://github.com/troessner/reek.git","ssh_url":"git@github.com:troessner/reek.git","clone_url":"https://github.com/troessner/reek.git","svn_url":"https://github.com/troessner/reek","homepage":"https://github.com/troessner/reek/wiki","size":5899,"stargazers_count":1199,"watchers_count":1199,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":80,"mirror_url":null,"open_issues_count":19,"forks":80,"open_issues":19,"watchers":1199,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/troessner/reek/pulls/371"},"html":{"href":"https://github.com/troessner/reek/pull/371"},"issue":{"href":"https://api.github.com/repos/troessner/reek/issues/371"},"comments":{"href":"https://api.github.com/repos/troessner/reek/issues/371/comments"},"review_comments":{"href":"https://api.github.com/repos/troessner/reek/pulls/371/comments"},"review_comment":{"href":"https://api.github.com/repos/troessner/reek/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/troessner/reek/pulls/371/commits"},"statuses":{"href":"https://api.github.com/repos/troessner/reek/statuses/56057e1202ed8a1792dcb8bd856493a6ebfe95b9"}}}}