{"action":"created","comment":{"url":"https://api.github.com/repos/troessner/reek/pulls/comments/74904639","id":74904639,"diff_hunk":"@@ -0,0 +1,84 @@\n+# frozen_string_literal: true\n+require_relative 'smell_detector'\n+require_relative 'smell_warning'\n+\n+module Reek\n+  module Smells\n+    #\n+    # The +InstanceVariableAssumption+ class is responsible for\n+    # detecting directly access of instance variables in a class\n+    # that does not define them in its initialize method.\n+    #\n+    class InstanceVariableAssumption < SmellDetector\n+      def self.contexts\n+        [:class]\n+      end\n+\n+      # Checks +klass+ for instance\n+      # variables assumptions.\n+      #\n+      # @return [Array<SmellWarning>]\n+      #\n+      def sniff(ctx)\n+        method_expressions = ctx.node_instance_methods\n+        assumptions = InstanceVariableAssumptionsExtractor.new(method_expressions).extract\n+\n+        return [] if assumptions.empty?\n+\n+        build_smell_warning(ctx, assumptions)\n+      end\n+\n+      private\n+\n+      def build_smell_warning(ctx, assumptions)\n+        message = \"assumes too much for instance variable #{assumptions.join(', ')}\"\n+\n+        [smell_warning(\n+          context: ctx,\n+          lines: [ctx.exp.line],\n+          message: message,\n+          parameters: { assumptions: assumptions })]\n+      end\n+\n+      #\n+      # The InstanceVariableAssumptionsExtractor is the class responsible for\n+      # extracting the assumptions from a method expression\n+      #\n+      class InstanceVariableAssumptionsExtractor","path":"lib/reek/smells/instance_variable_assumption.rb","position":47,"original_position":47,"commit_id":"8f14a5cee5c6f56e87975a16635d0b1a3d1ef022","original_commit_id":"f9e4186aa7e17a38c5f4fdb737f2fd5f17477202","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":"Ok, I'm fine with that as well 😆 ","created_at":"2016-08-16T09:41:57Z","updated_at":"2016-08-16T09:41:57Z","html_url":"https://github.com/troessner/reek/pull/1017#discussion_r74904639","pull_request_url":"https://api.github.com/repos/troessner/reek/pulls/1017","_links":{"self":{"href":"https://api.github.com/repos/troessner/reek/pulls/comments/74904639"},"html":{"href":"https://github.com/troessner/reek/pull/1017#discussion_r74904639"},"pull_request":{"href":"https://api.github.com/repos/troessner/reek/pulls/1017"}}},"pull_request":{"url":"https://api.github.com/repos/troessner/reek/pulls/1017","id":80661526,"html_url":"https://github.com/troessner/reek/pull/1017","diff_url":"https://github.com/troessner/reek/pull/1017.diff","patch_url":"https://github.com/troessner/reek/pull/1017.patch","issue_url":"https://api.github.com/repos/troessner/reek/issues/1017","number":1017,"state":"open","locked":false,"title":"Add Instance Variable Assumption smell detector","user":{"login":"waldyr","id":1893997,"avatar_url":"https://avatars.githubusercontent.com/u/1893997?v=3","gravatar_id":"","url":"https://api.github.com/users/waldyr","html_url":"https://github.com/waldyr","followers_url":"https://api.github.com/users/waldyr/followers","following_url":"https://api.github.com/users/waldyr/following{/other_user}","gists_url":"https://api.github.com/users/waldyr/gists{/gist_id}","starred_url":"https://api.github.com/users/waldyr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waldyr/subscriptions","organizations_url":"https://api.github.com/users/waldyr/orgs","repos_url":"https://api.github.com/users/waldyr/repos","events_url":"https://api.github.com/users/waldyr/events{/privacy}","received_events_url":"https://api.github.com/users/waldyr/received_events","type":"User","site_admin":false},"body":"#632 #633\r\n\r\nThis one might be difficult to have in practice.\r\n\r\nThis is a work in progress but review and comments are welcome :)","created_at":"2016-08-09T17:29:48Z","updated_at":"2016-08-16T09:41:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0aa0ab2f775a3888b914f14bb5d5d8d4db9c78d6","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/troessner/reek/pulls/1017/commits","review_comments_url":"https://api.github.com/repos/troessner/reek/pulls/1017/comments","review_comment_url":"https://api.github.com/repos/troessner/reek/pulls/comments{/number}","comments_url":"https://api.github.com/repos/troessner/reek/issues/1017/comments","statuses_url":"https://api.github.com/repos/troessner/reek/statuses/8f14a5cee5c6f56e87975a16635d0b1a3d1ef022","head":{"label":"troessner:add/ivar-assumption","ref":"add/ivar-assumption","sha":"8f14a5cee5c6f56e87975a16635d0b1a3d1ef022","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}","deployments_url":"https://api.github.com/repos/troessner/reek/deployments","created_at":"2008-09-05T10:48:33Z","updated_at":"2016-08-15T08:39:41Z","pushed_at":"2016-08-15T17:16:54Z","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":5342,"stargazers_count":2044,"watchers_count":2044,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":133,"mirror_url":null,"open_issues_count":36,"forks":133,"open_issues":36,"watchers":2044,"default_branch":"master"}},"base":{"label":"troessner:master","ref":"master","sha":"70c66862b244f30c4f71f4fffbf71fd1d517598c","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}","deployments_url":"https://api.github.com/repos/troessner/reek/deployments","created_at":"2008-09-05T10:48:33Z","updated_at":"2016-08-15T08:39:41Z","pushed_at":"2016-08-15T17:16:54Z","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":5342,"stargazers_count":2044,"watchers_count":2044,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":133,"mirror_url":null,"open_issues_count":36,"forks":133,"open_issues":36,"watchers":2044,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/troessner/reek/pulls/1017"},"html":{"href":"https://github.com/troessner/reek/pull/1017"},"issue":{"href":"https://api.github.com/repos/troessner/reek/issues/1017"},"comments":{"href":"https://api.github.com/repos/troessner/reek/issues/1017/comments"},"review_comments":{"href":"https://api.github.com/repos/troessner/reek/pulls/1017/comments"},"review_comment":{"href":"https://api.github.com/repos/troessner/reek/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/troessner/reek/pulls/1017/commits"},"statuses":{"href":"https://api.github.com/repos/troessner/reek/statuses/8f14a5cee5c6f56e87975a16635d0b1a3d1ef022"}}}}
{"actor":{"display_login":"troessner"}}