{"action":"created","comment":{"url":"https://api.github.com/repos/nitlang/nit/pulls/comments/118140246","pull_request_review_id":39902429,"id":118140246,"diff_hunk":"@@ -0,0 +1,70 @@\n+# This file is part of NIT ( http://www.nitlanguage.org ).\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+#     http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+module method_analyse_metrics\n+\n+# We usualy need specific phases\n+# NOTE: `frontend` is sufficent in most case (it is often too much)\n+import frontend\n+\n+import metrics_base\n+import mclasses_metrics\n+import semantize\n+\n+fun callvisiteMethodAnalyse(aclasse : AClassdef) : Array[MethodAnalyse] do\n+\tvar visitors = new Array[MethodAnalyse]\n+\tfor n_prop in aclasse.n_propdefs do\n+\t\t#Check if the property is a method definition\n+\t\tif n_prop isa AMethPropdef then \n+\t\t\tif n_prop.n_methid isa AIdMethid then\n+\t\t\t\t#Call visitor to analyse the method\n+\t\t\t\tvar visitor = new MethodAnalyse(n_prop)\n+\t\t\t\tvisitor.enter_visit(n_prop)\n+\t\t\t\tvisitors.add(visitor)\n+\t\t\tend\n+\t\tend\n+\tend\n+\treturn visitors\n+end\n+\n+public class MethodAnalyse\n+\tsuper Visitor\n+\tvar nclassdef: AMethPropdef\n+\n+\tvar total_call = new Counter[ASendExpr]\n+\tvar lineDetail = new Counter[ASendExpr]\n+\tvar total_call_self = new Counter[ASendExpr]\n+\n+\n+\n+\tredef fun visit(n)\n+\tdo\n+\t\tn.visit_all(self)\n+\n+\t\tif n isa ASendExpr then\n+\t\t\t\n+\t\t\tif n.raw_arguments.length != 0 then\n+\t\t\t\tlineDetail.inc(n)\n+\t\t\tend\n+\n+\t\t\tvar callsite = n.callsite\n+\t\t\tif callsite != null then\n+\t\t\t\tself.total_call.inc(n)\n+\t\t\t\tif callsite.recv_is_self == true then\n+\t\t\t\t\tself.total_call_self.inc(n)\n+\t\t\t\tend\n+\t\t\tend\n+\t\tend\n+\tend\n+end","path":"src/metrics/method_analyse_metrics.nit","position":70,"original_position":70,"commit_id":"35beda75491dcd77f54e9e40dd070fe6ff0b6b92","original_commit_id":"35beda75491dcd77f54e9e40dd070fe6ff0b6b92","user":{"login":"R4PaSs","id":1444825,"avatar_url":"https://avatars0.githubusercontent.com/u/1444825?v=3","gravatar_id":"","url":"https://api.github.com/users/R4PaSs","html_url":"https://github.com/R4PaSs","followers_url":"https://api.github.com/users/R4PaSs/followers","following_url":"https://api.github.com/users/R4PaSs/following{/other_user}","gists_url":"https://api.github.com/users/R4PaSs/gists{/gist_id}","starred_url":"https://api.github.com/users/R4PaSs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/R4PaSs/subscriptions","organizations_url":"https://api.github.com/users/R4PaSs/orgs","repos_url":"https://api.github.com/users/R4PaSs/repos","events_url":"https://api.github.com/users/R4PaSs/events{/privacy}","received_events_url":"https://api.github.com/users/R4PaSs/received_events","type":"User","site_admin":false},"body":"Same newline issue here","created_at":"2017-05-24T00:58:00Z","updated_at":"2017-05-24T00:59:56Z","html_url":"https://github.com/nitlang/nit/pull/2445#discussion_r118140246","pull_request_url":"https://api.github.com/repos/nitlang/nit/pulls/2445","_links":{"self":{"href":"https://api.github.com/repos/nitlang/nit/pulls/comments/118140246"},"html":{"href":"https://github.com/nitlang/nit/pull/2445#discussion_r118140246"},"pull_request":{"href":"https://api.github.com/repos/nitlang/nit/pulls/2445"}}},"pull_request":{"url":"https://api.github.com/repos/nitlang/nit/pulls/2445","id":120630746,"html_url":"https://github.com/nitlang/nit/pull/2445","diff_url":"https://github.com/nitlang/nit/pull/2445.diff","patch_url":"https://github.com/nitlang/nit/pull/2445.patch","issue_url":"https://api.github.com/repos/nitlang/nit/issues/2445","number":2445,"state":"open","locked":false,"title":"nitsmell : Add code smell detection","user":{"login":"Delja","id":26239416,"avatar_url":"https://avatars2.githubusercontent.com/u/26239416?v=3","gravatar_id":"","url":"https://api.github.com/users/Delja","html_url":"https://github.com/Delja","followers_url":"https://api.github.com/users/Delja/followers","following_url":"https://api.github.com/users/Delja/following{/other_user}","gists_url":"https://api.github.com/users/Delja/gists{/gist_id}","starred_url":"https://api.github.com/users/Delja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Delja/subscriptions","organizations_url":"https://api.github.com/users/Delja/orgs","repos_url":"https://api.github.com/users/Delja/repos","events_url":"https://api.github.com/users/Delja/events{/privacy}","received_events_url":"https://api.github.com/users/Delja/received_events","type":"User","site_admin":false},"body":"Adding code smell detection :\r\n\r\n- Long class\r\n- Long method parameter list\r\n- Long size method\r\n- Feature envy\r\n\r\nAdding a visitor to analyse the contents of the methods","created_at":"2017-05-15T15:34:35Z","updated_at":"2017-05-24T00:59:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dd283ce3cd593d23a466d4eb841d6f70ee9e47d1","assignee":null,"assignees":[],"requested_reviewers":[{"login":"Morriar","id":583144,"avatar_url":"https://avatars1.githubusercontent.com/u/583144?v=3","gravatar_id":"","url":"https://api.github.com/users/Morriar","html_url":"https://github.com/Morriar","followers_url":"https://api.github.com/users/Morriar/followers","following_url":"https://api.github.com/users/Morriar/following{/other_user}","gists_url":"https://api.github.com/users/Morriar/gists{/gist_id}","starred_url":"https://api.github.com/users/Morriar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Morriar/subscriptions","organizations_url":"https://api.github.com/users/Morriar/orgs","repos_url":"https://api.github.com/users/Morriar/repos","events_url":"https://api.github.com/users/Morriar/events{/privacy}","received_events_url":"https://api.github.com/users/Morriar/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/nitlang/nit/pulls/2445/commits","review_comments_url":"https://api.github.com/repos/nitlang/nit/pulls/2445/comments","review_comment_url":"https://api.github.com/repos/nitlang/nit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nitlang/nit/issues/2445/comments","statuses_url":"https://api.github.com/repos/nitlang/nit/statuses/35beda75491dcd77f54e9e40dd070fe6ff0b6b92","head":{"label":"Delja:master","ref":"master","sha":"35beda75491dcd77f54e9e40dd070fe6ff0b6b92","user":{"login":"Delja","id":26239416,"avatar_url":"https://avatars2.githubusercontent.com/u/26239416?v=3","gravatar_id":"","url":"https://api.github.com/users/Delja","html_url":"https://github.com/Delja","followers_url":"https://api.github.com/users/Delja/followers","following_url":"https://api.github.com/users/Delja/following{/other_user}","gists_url":"https://api.github.com/users/Delja/gists{/gist_id}","starred_url":"https://api.github.com/users/Delja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Delja/subscriptions","organizations_url":"https://api.github.com/users/Delja/orgs","repos_url":"https://api.github.com/users/Delja/repos","events_url":"https://api.github.com/users/Delja/events{/privacy}","received_events_url":"https://api.github.com/users/Delja/received_events","type":"User","site_admin":false},"repo":{"id":91346061,"name":"nit","full_name":"Delja/nit","owner":{"login":"Delja","id":26239416,"avatar_url":"https://avatars2.githubusercontent.com/u/26239416?v=3","gravatar_id":"","url":"https://api.github.com/users/Delja","html_url":"https://github.com/Delja","followers_url":"https://api.github.com/users/Delja/followers","following_url":"https://api.github.com/users/Delja/following{/other_user}","gists_url":"https://api.github.com/users/Delja/gists{/gist_id}","starred_url":"https://api.github.com/users/Delja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Delja/subscriptions","organizations_url":"https://api.github.com/users/Delja/orgs","repos_url":"https://api.github.com/users/Delja/repos","events_url":"https://api.github.com/users/Delja/events{/privacy}","received_events_url":"https://api.github.com/users/Delja/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Delja/nit","description":"Nit language","fork":true,"url":"https://api.github.com/repos/Delja/nit","forks_url":"https://api.github.com/repos/Delja/nit/forks","keys_url":"https://api.github.com/repos/Delja/nit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Delja/nit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Delja/nit/teams","hooks_url":"https://api.github.com/repos/Delja/nit/hooks","issue_events_url":"https://api.github.com/repos/Delja/nit/issues/events{/number}","events_url":"https://api.github.com/repos/Delja/nit/events","assignees_url":"https://api.github.com/repos/Delja/nit/assignees{/user}","branches_url":"https://api.github.com/repos/Delja/nit/branches{/branch}","tags_url":"https://api.github.com/repos/Delja/nit/tags","blobs_url":"https://api.github.com/repos/Delja/nit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Delja/nit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Delja/nit/git/refs{/sha}","trees_url":"https://api.github.com/repos/Delja/nit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Delja/nit/statuses/{sha}","languages_url":"https://api.github.com/repos/Delja/nit/languages","stargazers_url":"https://api.github.com/repos/Delja/nit/stargazers","contributors_url":"https://api.github.com/repos/Delja/nit/contributors","subscribers_url":"https://api.github.com/repos/Delja/nit/subscribers","subscription_url":"https://api.github.com/repos/Delja/nit/subscription","commits_url":"https://api.github.com/repos/Delja/nit/commits{/sha}","git_commits_url":"https://api.github.com/repos/Delja/nit/git/commits{/sha}","comments_url":"https://api.github.com/repos/Delja/nit/comments{/number}","issue_comment_url":"https://api.github.com/repos/Delja/nit/issues/comments{/number}","contents_url":"https://api.github.com/repos/Delja/nit/contents/{+path}","compare_url":"https://api.github.com/repos/Delja/nit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Delja/nit/merges","archive_url":"https://api.github.com/repos/Delja/nit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Delja/nit/downloads","issues_url":"https://api.github.com/repos/Delja/nit/issues{/number}","pulls_url":"https://api.github.com/repos/Delja/nit/pulls{/number}","milestones_url":"https://api.github.com/repos/Delja/nit/milestones{/number}","notifications_url":"https://api.github.com/repos/Delja/nit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Delja/nit/labels{/name}","releases_url":"https://api.github.com/repos/Delja/nit/releases{/id}","deployments_url":"https://api.github.com/repos/Delja/nit/deployments","created_at":"2017-05-15T14:16:04Z","updated_at":"2017-05-15T14:16:15Z","pushed_at":"2017-05-15T15:24:52Z","git_url":"git://github.com/Delja/nit.git","ssh_url":"git@github.com:Delja/nit.git","clone_url":"https://github.com/Delja/nit.git","svn_url":"https://github.com/Delja/nit","homepage":"http://nitlanguage.org","size":120044,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"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":"nitlang:master","ref":"master","sha":"a1eb491890dd3378af576e9e44ef09e66e8095eb","user":{"login":"nitlang","id":5420298,"avatar_url":"https://avatars2.githubusercontent.com/u/5420298?v=3","gravatar_id":"","url":"https://api.github.com/users/nitlang","html_url":"https://github.com/nitlang","followers_url":"https://api.github.com/users/nitlang/followers","following_url":"https://api.github.com/users/nitlang/following{/other_user}","gists_url":"https://api.github.com/users/nitlang/gists{/gist_id}","starred_url":"https://api.github.com/users/nitlang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nitlang/subscriptions","organizations_url":"https://api.github.com/users/nitlang/orgs","repos_url":"https://api.github.com/users/nitlang/repos","events_url":"https://api.github.com/users/nitlang/events{/privacy}","received_events_url":"https://api.github.com/users/nitlang/received_events","type":"Organization","site_admin":false},"repo":{"id":328597,"name":"nit","full_name":"nitlang/nit","owner":{"login":"nitlang","id":5420298,"avatar_url":"https://avatars2.githubusercontent.com/u/5420298?v=3","gravatar_id":"","url":"https://api.github.com/users/nitlang","html_url":"https://github.com/nitlang","followers_url":"https://api.github.com/users/nitlang/followers","following_url":"https://api.github.com/users/nitlang/following{/other_user}","gists_url":"https://api.github.com/users/nitlang/gists{/gist_id}","starred_url":"https://api.github.com/users/nitlang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nitlang/subscriptions","organizations_url":"https://api.github.com/users/nitlang/orgs","repos_url":"https://api.github.com/users/nitlang/repos","events_url":"https://api.github.com/users/nitlang/events{/privacy}","received_events_url":"https://api.github.com/users/nitlang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nitlang/nit","description":"Nit language","fork":false,"url":"https://api.github.com/repos/nitlang/nit","forks_url":"https://api.github.com/repos/nitlang/nit/forks","keys_url":"https://api.github.com/repos/nitlang/nit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nitlang/nit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nitlang/nit/teams","hooks_url":"https://api.github.com/repos/nitlang/nit/hooks","issue_events_url":"https://api.github.com/repos/nitlang/nit/issues/events{/number}","events_url":"https://api.github.com/repos/nitlang/nit/events","assignees_url":"https://api.github.com/repos/nitlang/nit/assignees{/user}","branches_url":"https://api.github.com/repos/nitlang/nit/branches{/branch}","tags_url":"https://api.github.com/repos/nitlang/nit/tags","blobs_url":"https://api.github.com/repos/nitlang/nit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nitlang/nit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nitlang/nit/git/refs{/sha}","trees_url":"https://api.github.com/repos/nitlang/nit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nitlang/nit/statuses/{sha}","languages_url":"https://api.github.com/repos/nitlang/nit/languages","stargazers_url":"https://api.github.com/repos/nitlang/nit/stargazers","contributors_url":"https://api.github.com/repos/nitlang/nit/contributors","subscribers_url":"https://api.github.com/repos/nitlang/nit/subscribers","subscription_url":"https://api.github.com/repos/nitlang/nit/subscription","commits_url":"https://api.github.com/repos/nitlang/nit/commits{/sha}","git_commits_url":"https://api.github.com/repos/nitlang/nit/git/commits{/sha}","comments_url":"https://api.github.com/repos/nitlang/nit/comments{/number}","issue_comment_url":"https://api.github.com/repos/nitlang/nit/issues/comments{/number}","contents_url":"https://api.github.com/repos/nitlang/nit/contents/{+path}","compare_url":"https://api.github.com/repos/nitlang/nit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nitlang/nit/merges","archive_url":"https://api.github.com/repos/nitlang/nit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nitlang/nit/downloads","issues_url":"https://api.github.com/repos/nitlang/nit/issues{/number}","pulls_url":"https://api.github.com/repos/nitlang/nit/pulls{/number}","milestones_url":"https://api.github.com/repos/nitlang/nit/milestones{/number}","notifications_url":"https://api.github.com/repos/nitlang/nit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nitlang/nit/labels{/name}","releases_url":"https://api.github.com/repos/nitlang/nit/releases{/id}","deployments_url":"https://api.github.com/repos/nitlang/nit/deployments","created_at":"2009-10-06T15:03:00Z","updated_at":"2017-05-13T01:02:53Z","pushed_at":"2017-05-23T19:00:25Z","git_url":"git://github.com/nitlang/nit.git","ssh_url":"git@github.com:nitlang/nit.git","clone_url":"https://github.com/nitlang/nit.git","svn_url":"https://github.com/nitlang/nit","homepage":"http://nitlanguage.org","size":120145,"stargazers_count":156,"watchers_count":156,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":56,"mirror_url":null,"open_issues_count":179,"forks":56,"open_issues":179,"watchers":156,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nitlang/nit/pulls/2445"},"html":{"href":"https://github.com/nitlang/nit/pull/2445"},"issue":{"href":"https://api.github.com/repos/nitlang/nit/issues/2445"},"comments":{"href":"https://api.github.com/repos/nitlang/nit/issues/2445/comments"},"review_comments":{"href":"https://api.github.com/repos/nitlang/nit/pulls/2445/comments"},"review_comment":{"href":"https://api.github.com/repos/nitlang/nit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nitlang/nit/pulls/2445/commits"},"statuses":{"href":"https://api.github.com/repos/nitlang/nit/statuses/35beda75491dcd77f54e9e40dd070fe6ff0b6b92"}}}}
{"actor":{"display_login":"R4PaSs"}}