{"action":"created","comment":{"url":"https://api.github.com/repos/flerchy/My-2-PyProj/pulls/comments/134982417","pull_request_review_id":58338901,"id":134982417,"diff_hunk":"@@ -0,0 +1,472 @@\n+import re\n+import ast\n+\n+IMPLEMENTED_METRICS = [\n+    'FileLength',\n+    'FunctionNameCase',\n+    'NestingLoops',\n+]\n+\n+INF = 99999\n+\n+\n+class FileLength:\n+    discrete_groups = [\n+        {\n+            'name': 'From0To40',\n+            'from': 0,\n+            'to': 40,\n+        },\n+        {\n+            'name': 'From41To200',\n+            'from': 41,\n+            'to': 200,\n+        },\n+        {\n+            'name': 'From201To600',\n+            'from': 201,\n+            'to': 600,\n+        },\n+        {\n+            'name': 'From601To1500',\n+            'from': 601,\n+            'to': 1500,\n+        },\n+        {\n+            'name': 'From1501To5000',\n+            'from': 1501,\n+            'to': 5000,\n+        },\n+        {\n+            'name': 'From5000ToInf',\n+            'from': 5000,\n+            'to': INF,\n+        },\n+    ]\n+    inspections = {\n+        'too_many_lines': 'Less than {0}% of files have approximately same size.'\n+                          ' Maybe you need to split this file in parts.'\n+    }\n+\n+    \"\"\" Number of lines in file. Verbose version doesn't require specific logic. \"\"\"\n+\n+    def count(self, file, verbose=False):\n+        i = 0\n+        with open(file) as f:\n+            for i, _ in enumerate(f, 1):\n+                pass\n+        return {'{0}'.format(i): 1}\n+\n+    def discretize(self, values):\n+        discrete_values = {}\n+        sum = 0.0\n+        for group in self.discrete_groups:\n+            discrete_values[group['name']] = 0\n+        for value, count in values.items():\n+            for group in self.discrete_groups:\n+                if group['from'] <= int(value) <= group['to']:\n+                    discrete_values[group['name']] += count\n+                    sum += count\n+                    continue\n+        for key, value in discrete_values.items():\n+            discrete_values[key] = value / sum\n+        return discrete_values\n+\n+    def inspect(self, discrete, values):\n+        value = list(values.keys())[0]\n+        percent = 0.0\n+        for group in self.discrete_groups:\n+            if group['from'] <= int(value) <= group['to']:\n+                value_group = group\n+                percent += discrete[group['name']]\n+            elif int(value) <= group['from']:\n+                # If file contains fewer lines it's ok\n+                percent += discrete[group['name']]\n+        inspections = {}\n+        too_many_lines = 'too_many_lines'\n+        if percent < 0.05:\n+            inspections[too_many_lines] = {'message': self.inspections[too_many_lines].format(5)}\n+        elif percent < 0.1:\n+            inspections[too_many_lines] = {'message': self.inspections[too_many_lines].format(10)}\n+        elif percent < 0.2:\n+            inspections[too_many_lines] = {'message': self.inspections[too_many_lines].format(20)}\n+        return inspections\n+\n+\n+class FunctionNameCase:\n+    NEED_TO_USE_CAMEL_CASE = 'need_to_use_camelcase'\n+    NEED_TO_USE_UNDERSCORE = 'need_to_use_underscore'\n+    NO_STYLE = 'no_style'\n+    discrete_groups = [\n+        {\n+            'name': 'underscore',\n+        },\n+        {\n+            'name': 'camelcase',\n+        },\n+        {\n+            'name': 'other',\n+        },","path":"long.py","position":109,"original_position":109,"commit_id":"4388dca541f29fc5880d19eebbb205844dbe708c","original_commit_id":"4388dca541f29fc5880d19eebbb205844dbe708c","user":{"login":"CheckiePyBot","id":29826482,"avatar_url":"https://avatars1.githubusercontent.com/u/29826482?v=4","gravatar_id":"","url":"https://api.github.com/users/CheckiePyBot","html_url":"https://github.com/CheckiePyBot","followers_url":"https://api.github.com/users/CheckiePyBot/followers","following_url":"https://api.github.com/users/CheckiePyBot/following{/other_user}","gists_url":"https://api.github.com/users/CheckiePyBot/gists{/gist_id}","starred_url":"https://api.github.com/users/CheckiePyBot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CheckiePyBot/subscriptions","organizations_url":"https://api.github.com/users/CheckiePyBot/orgs","repos_url":"https://api.github.com/users/CheckiePyBot/repos","events_url":"https://api.github.com/users/CheckiePyBot/events{/privacy}","received_events_url":"https://api.github.com/users/CheckiePyBot/received_events","type":"User","site_admin":false},"body":"Mostly spaces are put near braces, maybe you need to add spaces near braces here.","created_at":"2017-08-24T10:38:55Z","updated_at":"2017-08-24T10:38:55Z","html_url":"https://github.com/flerchy/My-2-PyProj/pull/4#discussion_r134982417","pull_request_url":"https://api.github.com/repos/flerchy/My-2-PyProj/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/flerchy/My-2-PyProj/pulls/comments/134982417"},"html":{"href":"https://github.com/flerchy/My-2-PyProj/pull/4#discussion_r134982417"},"pull_request":{"href":"https://api.github.com/repos/flerchy/My-2-PyProj/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/flerchy/My-2-PyProj/pulls/4","id":137422608,"html_url":"https://github.com/flerchy/My-2-PyProj/pull/4","diff_url":"https://github.com/flerchy/My-2-PyProj/pull/4.diff","patch_url":"https://github.com/flerchy/My-2-PyProj/pull/4.patch","issue_url":"https://api.github.com/repos/flerchy/My-2-PyProj/issues/4","number":4,"state":"open","locked":false,"title":"sample pull 2","user":{"login":"flerchy","id":15039078,"avatar_url":"https://avatars2.githubusercontent.com/u/15039078?v=4","gravatar_id":"","url":"https://api.github.com/users/flerchy","html_url":"https://github.com/flerchy","followers_url":"https://api.github.com/users/flerchy/followers","following_url":"https://api.github.com/users/flerchy/following{/other_user}","gists_url":"https://api.github.com/users/flerchy/gists{/gist_id}","starred_url":"https://api.github.com/users/flerchy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flerchy/subscriptions","organizations_url":"https://api.github.com/users/flerchy/orgs","repos_url":"https://api.github.com/users/flerchy/repos","events_url":"https://api.github.com/users/flerchy/events{/privacy}","received_events_url":"https://api.github.com/users/flerchy/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-08-24T10:37:52Z","updated_at":"2017-08-24T10:38:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0fec607d578ee569690f2c8fb190d1265e8806ef","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/flerchy/My-2-PyProj/pulls/4/commits","review_comments_url":"https://api.github.com/repos/flerchy/My-2-PyProj/pulls/4/comments","review_comment_url":"https://api.github.com/repos/flerchy/My-2-PyProj/pulls/comments{/number}","comments_url":"https://api.github.com/repos/flerchy/My-2-PyProj/issues/4/comments","statuses_url":"https://api.github.com/repos/flerchy/My-2-PyProj/statuses/4388dca541f29fc5880d19eebbb205844dbe708c","head":{"label":"flerchy:longer","ref":"longer","sha":"4388dca541f29fc5880d19eebbb205844dbe708c","user":{"login":"flerchy","id":15039078,"avatar_url":"https://avatars2.githubusercontent.com/u/15039078?v=4","gravatar_id":"","url":"https://api.github.com/users/flerchy","html_url":"https://github.com/flerchy","followers_url":"https://api.github.com/users/flerchy/followers","following_url":"https://api.github.com/users/flerchy/following{/other_user}","gists_url":"https://api.github.com/users/flerchy/gists{/gist_id}","starred_url":"https://api.github.com/users/flerchy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flerchy/subscriptions","organizations_url":"https://api.github.com/users/flerchy/orgs","repos_url":"https://api.github.com/users/flerchy/repos","events_url":"https://api.github.com/users/flerchy/events{/privacy}","received_events_url":"https://api.github.com/users/flerchy/received_events","type":"User","site_admin":false},"repo":{"id":95828446,"name":"My-2-PyProj","full_name":"flerchy/My-2-PyProj","owner":{"login":"flerchy","id":15039078,"avatar_url":"https://avatars2.githubusercontent.com/u/15039078?v=4","gravatar_id":"","url":"https://api.github.com/users/flerchy","html_url":"https://github.com/flerchy","followers_url":"https://api.github.com/users/flerchy/followers","following_url":"https://api.github.com/users/flerchy/following{/other_user}","gists_url":"https://api.github.com/users/flerchy/gists{/gist_id}","starred_url":"https://api.github.com/users/flerchy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flerchy/subscriptions","organizations_url":"https://api.github.com/users/flerchy/orgs","repos_url":"https://api.github.com/users/flerchy/repos","events_url":"https://api.github.com/users/flerchy/events{/privacy}","received_events_url":"https://api.github.com/users/flerchy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/flerchy/My-2-PyProj","description":null,"fork":false,"url":"https://api.github.com/repos/flerchy/My-2-PyProj","forks_url":"https://api.github.com/repos/flerchy/My-2-PyProj/forks","keys_url":"https://api.github.com/repos/flerchy/My-2-PyProj/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flerchy/My-2-PyProj/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flerchy/My-2-PyProj/teams","hooks_url":"https://api.github.com/repos/flerchy/My-2-PyProj/hooks","issue_events_url":"https://api.github.com/repos/flerchy/My-2-PyProj/issues/events{/number}","events_url":"https://api.github.com/repos/flerchy/My-2-PyProj/events","assignees_url":"https://api.github.com/repos/flerchy/My-2-PyProj/assignees{/user}","branches_url":"https://api.github.com/repos/flerchy/My-2-PyProj/branches{/branch}","tags_url":"https://api.github.com/repos/flerchy/My-2-PyProj/tags","blobs_url":"https://api.github.com/repos/flerchy/My-2-PyProj/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flerchy/My-2-PyProj/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flerchy/My-2-PyProj/git/refs{/sha}","trees_url":"https://api.github.com/repos/flerchy/My-2-PyProj/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flerchy/My-2-PyProj/statuses/{sha}","languages_url":"https://api.github.com/repos/flerchy/My-2-PyProj/languages","stargazers_url":"https://api.github.com/repos/flerchy/My-2-PyProj/stargazers","contributors_url":"https://api.github.com/repos/flerchy/My-2-PyProj/contributors","subscribers_url":"https://api.github.com/repos/flerchy/My-2-PyProj/subscribers","subscription_url":"https://api.github.com/repos/flerchy/My-2-PyProj/subscription","commits_url":"https://api.github.com/repos/flerchy/My-2-PyProj/commits{/sha}","git_commits_url":"https://api.github.com/repos/flerchy/My-2-PyProj/git/commits{/sha}","comments_url":"https://api.github.com/repos/flerchy/My-2-PyProj/comments{/number}","issue_comment_url":"https://api.github.com/repos/flerchy/My-2-PyProj/issues/comments{/number}","contents_url":"https://api.github.com/repos/flerchy/My-2-PyProj/contents/{+path}","compare_url":"https://api.github.com/repos/flerchy/My-2-PyProj/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flerchy/My-2-PyProj/merges","archive_url":"https://api.github.com/repos/flerchy/My-2-PyProj/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flerchy/My-2-PyProj/downloads","issues_url":"https://api.github.com/repos/flerchy/My-2-PyProj/issues{/number}","pulls_url":"https://api.github.com/repos/flerchy/My-2-PyProj/pulls{/number}","milestones_url":"https://api.github.com/repos/flerchy/My-2-PyProj/milestones{/number}","notifications_url":"https://api.github.com/repos/flerchy/My-2-PyProj/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flerchy/My-2-PyProj/labels{/name}","releases_url":"https://api.github.com/repos/flerchy/My-2-PyProj/releases{/id}","deployments_url":"https://api.github.com/repos/flerchy/My-2-PyProj/deployments","created_at":"2017-06-29T23:25:48Z","updated_at":"2017-06-29T23:32:09Z","pushed_at":"2017-08-24T10:37:52Z","git_url":"git://github.com/flerchy/My-2-PyProj.git","ssh_url":"git@github.com:flerchy/My-2-PyProj.git","clone_url":"https://github.com/flerchy/My-2-PyProj.git","svn_url":"https://github.com/flerchy/My-2-PyProj","homepage":null,"size":5,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"longer"}},"base":{"label":"flerchy:master","ref":"master","sha":"fc2e207e3e53df6fe751ca66b363634b16f4226a","user":{"login":"flerchy","id":15039078,"avatar_url":"https://avatars2.githubusercontent.com/u/15039078?v=4","gravatar_id":"","url":"https://api.github.com/users/flerchy","html_url":"https://github.com/flerchy","followers_url":"https://api.github.com/users/flerchy/followers","following_url":"https://api.github.com/users/flerchy/following{/other_user}","gists_url":"https://api.github.com/users/flerchy/gists{/gist_id}","starred_url":"https://api.github.com/users/flerchy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flerchy/subscriptions","organizations_url":"https://api.github.com/users/flerchy/orgs","repos_url":"https://api.github.com/users/flerchy/repos","events_url":"https://api.github.com/users/flerchy/events{/privacy}","received_events_url":"https://api.github.com/users/flerchy/received_events","type":"User","site_admin":false},"repo":{"id":95828446,"name":"My-2-PyProj","full_name":"flerchy/My-2-PyProj","owner":{"login":"flerchy","id":15039078,"avatar_url":"https://avatars2.githubusercontent.com/u/15039078?v=4","gravatar_id":"","url":"https://api.github.com/users/flerchy","html_url":"https://github.com/flerchy","followers_url":"https://api.github.com/users/flerchy/followers","following_url":"https://api.github.com/users/flerchy/following{/other_user}","gists_url":"https://api.github.com/users/flerchy/gists{/gist_id}","starred_url":"https://api.github.com/users/flerchy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flerchy/subscriptions","organizations_url":"https://api.github.com/users/flerchy/orgs","repos_url":"https://api.github.com/users/flerchy/repos","events_url":"https://api.github.com/users/flerchy/events{/privacy}","received_events_url":"https://api.github.com/users/flerchy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/flerchy/My-2-PyProj","description":null,"fork":false,"url":"https://api.github.com/repos/flerchy/My-2-PyProj","forks_url":"https://api.github.com/repos/flerchy/My-2-PyProj/forks","keys_url":"https://api.github.com/repos/flerchy/My-2-PyProj/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flerchy/My-2-PyProj/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flerchy/My-2-PyProj/teams","hooks_url":"https://api.github.com/repos/flerchy/My-2-PyProj/hooks","issue_events_url":"https://api.github.com/repos/flerchy/My-2-PyProj/issues/events{/number}","events_url":"https://api.github.com/repos/flerchy/My-2-PyProj/events","assignees_url":"https://api.github.com/repos/flerchy/My-2-PyProj/assignees{/user}","branches_url":"https://api.github.com/repos/flerchy/My-2-PyProj/branches{/branch}","tags_url":"https://api.github.com/repos/flerchy/My-2-PyProj/tags","blobs_url":"https://api.github.com/repos/flerchy/My-2-PyProj/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flerchy/My-2-PyProj/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flerchy/My-2-PyProj/git/refs{/sha}","trees_url":"https://api.github.com/repos/flerchy/My-2-PyProj/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flerchy/My-2-PyProj/statuses/{sha}","languages_url":"https://api.github.com/repos/flerchy/My-2-PyProj/languages","stargazers_url":"https://api.github.com/repos/flerchy/My-2-PyProj/stargazers","contributors_url":"https://api.github.com/repos/flerchy/My-2-PyProj/contributors","subscribers_url":"https://api.github.com/repos/flerchy/My-2-PyProj/subscribers","subscription_url":"https://api.github.com/repos/flerchy/My-2-PyProj/subscription","commits_url":"https://api.github.com/repos/flerchy/My-2-PyProj/commits{/sha}","git_commits_url":"https://api.github.com/repos/flerchy/My-2-PyProj/git/commits{/sha}","comments_url":"https://api.github.com/repos/flerchy/My-2-PyProj/comments{/number}","issue_comment_url":"https://api.github.com/repos/flerchy/My-2-PyProj/issues/comments{/number}","contents_url":"https://api.github.com/repos/flerchy/My-2-PyProj/contents/{+path}","compare_url":"https://api.github.com/repos/flerchy/My-2-PyProj/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flerchy/My-2-PyProj/merges","archive_url":"https://api.github.com/repos/flerchy/My-2-PyProj/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flerchy/My-2-PyProj/downloads","issues_url":"https://api.github.com/repos/flerchy/My-2-PyProj/issues{/number}","pulls_url":"https://api.github.com/repos/flerchy/My-2-PyProj/pulls{/number}","milestones_url":"https://api.github.com/repos/flerchy/My-2-PyProj/milestones{/number}","notifications_url":"https://api.github.com/repos/flerchy/My-2-PyProj/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flerchy/My-2-PyProj/labels{/name}","releases_url":"https://api.github.com/repos/flerchy/My-2-PyProj/releases{/id}","deployments_url":"https://api.github.com/repos/flerchy/My-2-PyProj/deployments","created_at":"2017-06-29T23:25:48Z","updated_at":"2017-06-29T23:32:09Z","pushed_at":"2017-08-24T10:37:52Z","git_url":"git://github.com/flerchy/My-2-PyProj.git","ssh_url":"git@github.com:flerchy/My-2-PyProj.git","clone_url":"https://github.com/flerchy/My-2-PyProj.git","svn_url":"https://github.com/flerchy/My-2-PyProj","homepage":null,"size":5,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"longer"}},"_links":{"self":{"href":"https://api.github.com/repos/flerchy/My-2-PyProj/pulls/4"},"html":{"href":"https://github.com/flerchy/My-2-PyProj/pull/4"},"issue":{"href":"https://api.github.com/repos/flerchy/My-2-PyProj/issues/4"},"comments":{"href":"https://api.github.com/repos/flerchy/My-2-PyProj/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/flerchy/My-2-PyProj/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/flerchy/My-2-PyProj/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/flerchy/My-2-PyProj/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/flerchy/My-2-PyProj/statuses/4388dca541f29fc5880d19eebbb205844dbe708c"}}}}
{"actor":{"display_login":"CheckiePyBot"}}