{"action":"created","comment":{"url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/comments/54369648","id":54369648,"diff_hunk":"@@ -0,0 +1,117 @@\n+'use strict';\r\n+\r\n+const fs = require('fs');\r\n+const request = require('request');\r\n+const http = require('http');\r\n+const async = require('async');\r\n+const natural = require('natural');\r\n+natural.PorterStemmerRu.attach();\r\n+const token = fs.readFileSync('./key.txt', 'utf-8');\r\n+const reposUrl = 'https://api.github.com/orgs/urfu-2015/repos';\r\n+\r\n+\r\n+function getStat(method, arg) {\r\n+    async.waterfall(\r\n+        [\r\n+            function getRepos(callback) {\r\n+                request(getRequestOptions(reposUrl), function (err, response, body) {\r\n+                    var resp;\r\n+                    if (!err && response.statusCode === 200) {\r\n+                        resp = JSON.parse(body);\r\n+                        callback(null, resp);\r\n+                    } else {\r\n+                        callback(err, resp);\r\n+                        console.log(response.statusCode);\r\n+                    }\r\n+                });\r\n+            },\r\n+\r\n+            function getReadmeWords(repos, callback) {\r\n+                var words = {};\r\n+                const org = 'https://api.github.com/repos/urfu-2015/';\r\n+                const readmePaths = [];\r\n+                repos.forEach(function (repo) {\r\n+                    const name = repo.name;\r\n+                    if (name && name.indexOf('tasks') !== -1) {\r\n+                        readmePaths.push(org + name + '/readme');\r\n+                    }\r\n+                });\r\n+\r\n+                async.each(\r\n+                    readmePaths,\r\n+\r\n+                    function (path, next) {\r\n+                        request(getRequestOptions(path), function (err, response, body) {\r\n+                            if (!err && response.statusCode === 200) {\r\n+                                const readme = new Buffer(\r\n+                                    JSON.parse(body).content, 'base64').toString('utf-8');\r\n+                                const readmeWords = parseText(readme);\r\n+                                readmeWords.forEach(function (word) {\r\n+                                    let lower = word.toLowerCase();\r\n+                                    words[lower] = words[lower] ? ++words[lower] : 1;\r\n+                                });\r\n+                                next();\r\n+                            } else {\r\n+                                next(err);\r\n+                            }\r\n+                        });\r\n+                    },\r\n+\r\n+                    function (err) {\r\n+                        callback(err, words);\r\n+                    });\r\n+            },\r\n+\r\n+            function printStat(words, callback) {\r\n+                const wordsArr = Object.keys(words);\r\n+                const resultObj = {};\r\n+                const resultArr = [];\r\n+                const roots = {};\r\n+                wordsArr.forEach(function (word) {\r\n+                    let stem = word.stem();\r\n+                    resultObj[stem] = resultObj[stem] ? resultObj[stem] + words[word] : words[word];\r\n+                    if (roots[stem]) {\r\n+                        roots[stem].push(word);\r","path":"counter.js","position":74,"original_position":74,"commit_id":"3a1ae52ecdcc0566d4734606004d318404cec16a","original_commit_id":"3a1ae52ecdcc0566d4734606004d318404cec16a","user":{"login":"mokhov","id":357689,"avatar_url":"https://avatars.githubusercontent.com/u/357689?v=3","gravatar_id":"","url":"https://api.github.com/users/mokhov","html_url":"https://github.com/mokhov","followers_url":"https://api.github.com/users/mokhov/followers","following_url":"https://api.github.com/users/mokhov/following{/other_user}","gists_url":"https://api.github.com/users/mokhov/gists{/gist_id}","starred_url":"https://api.github.com/users/mokhov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mokhov/subscriptions","organizations_url":"https://api.github.com/users/mokhov/orgs","repos_url":"https://api.github.com/users/mokhov/repos","events_url":"https://api.github.com/users/mokhov/events{/privacy}","received_events_url":"https://api.github.com/users/mokhov/received_events","type":"User","site_admin":false},"body":"Так и не понял зачем тебе два объекта `resultObj` и `root`, когда можно было всё хранить в одном","created_at":"2016-02-29T05:05:18Z","updated_at":"2016-02-29T05:05:18Z","html_url":"https://github.com/urfu-2015/webdev-tasks-1/pull/22#discussion_r54369648","pull_request_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/22","_links":{"self":{"href":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/comments/54369648"},"html":{"href":"https://github.com/urfu-2015/webdev-tasks-1/pull/22#discussion_r54369648"},"pull_request":{"href":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/22"}}},"pull_request":{"url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/22","id":60587215,"html_url":"https://github.com/urfu-2015/webdev-tasks-1/pull/22","diff_url":"https://github.com/urfu-2015/webdev-tasks-1/pull/22.diff","patch_url":"https://github.com/urfu-2015/webdev-tasks-1/pull/22.patch","issue_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/issues/22","number":22,"state":"open","locked":false,"title":"Кузнецова Анна","user":{"login":"Anna-Smith","id":11731360,"avatar_url":"https://avatars.githubusercontent.com/u/11731360?v=3","gravatar_id":"","url":"https://api.github.com/users/Anna-Smith","html_url":"https://github.com/Anna-Smith","followers_url":"https://api.github.com/users/Anna-Smith/followers","following_url":"https://api.github.com/users/Anna-Smith/following{/other_user}","gists_url":"https://api.github.com/users/Anna-Smith/gists{/gist_id}","starred_url":"https://api.github.com/users/Anna-Smith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Anna-Smith/subscriptions","organizations_url":"https://api.github.com/users/Anna-Smith/orgs","repos_url":"https://api.github.com/users/Anna-Smith/repos","events_url":"https://api.github.com/users/Anna-Smith/events{/privacy}","received_events_url":"https://api.github.com/users/Anna-Smith/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-24T22:07:02Z","updated_at":"2016-02-29T05:05:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a02e2be499d85fcdeb05c2f62658b94996b611a8","assignee":{"login":"mokhov","id":357689,"avatar_url":"https://avatars.githubusercontent.com/u/357689?v=3","gravatar_id":"","url":"https://api.github.com/users/mokhov","html_url":"https://github.com/mokhov","followers_url":"https://api.github.com/users/mokhov/followers","following_url":"https://api.github.com/users/mokhov/following{/other_user}","gists_url":"https://api.github.com/users/mokhov/gists{/gist_id}","starred_url":"https://api.github.com/users/mokhov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mokhov/subscriptions","organizations_url":"https://api.github.com/users/mokhov/orgs","repos_url":"https://api.github.com/users/mokhov/repos","events_url":"https://api.github.com/users/mokhov/events{/privacy}","received_events_url":"https://api.github.com/users/mokhov/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/22/commits","review_comments_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/22/comments","review_comment_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/comments{/number}","comments_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/issues/22/comments","statuses_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/statuses/3a1ae52ecdcc0566d4734606004d318404cec16a","head":{"label":"Anna-Smith:master","ref":"master","sha":"3a1ae52ecdcc0566d4734606004d318404cec16a","user":{"login":"Anna-Smith","id":11731360,"avatar_url":"https://avatars.githubusercontent.com/u/11731360?v=3","gravatar_id":"","url":"https://api.github.com/users/Anna-Smith","html_url":"https://github.com/Anna-Smith","followers_url":"https://api.github.com/users/Anna-Smith/followers","following_url":"https://api.github.com/users/Anna-Smith/following{/other_user}","gists_url":"https://api.github.com/users/Anna-Smith/gists{/gist_id}","starred_url":"https://api.github.com/users/Anna-Smith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Anna-Smith/subscriptions","organizations_url":"https://api.github.com/users/Anna-Smith/orgs","repos_url":"https://api.github.com/users/Anna-Smith/repos","events_url":"https://api.github.com/users/Anna-Smith/events{/privacy}","received_events_url":"https://api.github.com/users/Anna-Smith/received_events","type":"User","site_admin":false},"repo":{"id":52200319,"name":"webdev-tasks-1","full_name":"Anna-Smith/webdev-tasks-1","owner":{"login":"Anna-Smith","id":11731360,"avatar_url":"https://avatars.githubusercontent.com/u/11731360?v=3","gravatar_id":"","url":"https://api.github.com/users/Anna-Smith","html_url":"https://github.com/Anna-Smith","followers_url":"https://api.github.com/users/Anna-Smith/followers","following_url":"https://api.github.com/users/Anna-Smith/following{/other_user}","gists_url":"https://api.github.com/users/Anna-Smith/gists{/gist_id}","starred_url":"https://api.github.com/users/Anna-Smith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Anna-Smith/subscriptions","organizations_url":"https://api.github.com/users/Anna-Smith/orgs","repos_url":"https://api.github.com/users/Anna-Smith/repos","events_url":"https://api.github.com/users/Anna-Smith/events{/privacy}","received_events_url":"https://api.github.com/users/Anna-Smith/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Anna-Smith/webdev-tasks-1","description":"","fork":true,"url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1","forks_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/forks","keys_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/teams","hooks_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/hooks","issue_events_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/issues/events{/number}","events_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/events","assignees_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/assignees{/user}","branches_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/branches{/branch}","tags_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/tags","blobs_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/statuses/{sha}","languages_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/languages","stargazers_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/stargazers","contributors_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/contributors","subscribers_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/subscribers","subscription_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/subscription","commits_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/contents/{+path}","compare_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/merges","archive_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/downloads","issues_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/issues{/number}","pulls_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/pulls{/number}","milestones_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/milestones{/number}","notifications_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/labels{/name}","releases_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/releases{/id}","deployments_url":"https://api.github.com/repos/Anna-Smith/webdev-tasks-1/deployments","created_at":"2016-02-21T09:57:24Z","updated_at":"2016-02-24T22:06:17Z","pushed_at":"2016-02-25T16:43:52Z","git_url":"git://github.com/Anna-Smith/webdev-tasks-1.git","ssh_url":"git@github.com:Anna-Smith/webdev-tasks-1.git","clone_url":"https://github.com/Anna-Smith/webdev-tasks-1.git","svn_url":"https://github.com/Anna-Smith/webdev-tasks-1","homepage":null,"size":6,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"urfu-2015:master","ref":"master","sha":"6ff732253132f88e1eec631e611136f3676768b7","user":{"login":"urfu-2015","id":14800971,"avatar_url":"https://avatars.githubusercontent.com/u/14800971?v=3","gravatar_id":"","url":"https://api.github.com/users/urfu-2015","html_url":"https://github.com/urfu-2015","followers_url":"https://api.github.com/users/urfu-2015/followers","following_url":"https://api.github.com/users/urfu-2015/following{/other_user}","gists_url":"https://api.github.com/users/urfu-2015/gists{/gist_id}","starred_url":"https://api.github.com/users/urfu-2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urfu-2015/subscriptions","organizations_url":"https://api.github.com/users/urfu-2015/orgs","repos_url":"https://api.github.com/users/urfu-2015/repos","events_url":"https://api.github.com/users/urfu-2015/events{/privacy}","received_events_url":"https://api.github.com/users/urfu-2015/received_events","type":"Organization","site_admin":false},"repo":{"id":52003967,"name":"webdev-tasks-1","full_name":"urfu-2015/webdev-tasks-1","owner":{"login":"urfu-2015","id":14800971,"avatar_url":"https://avatars.githubusercontent.com/u/14800971?v=3","gravatar_id":"","url":"https://api.github.com/users/urfu-2015","html_url":"https://github.com/urfu-2015","followers_url":"https://api.github.com/users/urfu-2015/followers","following_url":"https://api.github.com/users/urfu-2015/following{/other_user}","gists_url":"https://api.github.com/users/urfu-2015/gists{/gist_id}","starred_url":"https://api.github.com/users/urfu-2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urfu-2015/subscriptions","organizations_url":"https://api.github.com/users/urfu-2015/orgs","repos_url":"https://api.github.com/users/urfu-2015/repos","events_url":"https://api.github.com/users/urfu-2015/events{/privacy}","received_events_url":"https://api.github.com/users/urfu-2015/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/urfu-2015/webdev-tasks-1","description":"","fork":false,"url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1","forks_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/forks","keys_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/teams","hooks_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/hooks","issue_events_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/issues/events{/number}","events_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/events","assignees_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/assignees{/user}","branches_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/branches{/branch}","tags_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/tags","blobs_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/statuses/{sha}","languages_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/languages","stargazers_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/stargazers","contributors_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/contributors","subscribers_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/subscribers","subscription_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/subscription","commits_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/contents/{+path}","compare_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/merges","archive_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/downloads","issues_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/issues{/number}","pulls_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls{/number}","milestones_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/milestones{/number}","notifications_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/labels{/name}","releases_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/releases{/id}","deployments_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/deployments","created_at":"2016-02-18T11:54:14Z","updated_at":"2016-02-18T11:54:14Z","pushed_at":"2016-02-28T21:26:22Z","git_url":"git://github.com/urfu-2015/webdev-tasks-1.git","ssh_url":"git@github.com:urfu-2015/webdev-tasks-1.git","clone_url":"https://github.com/urfu-2015/webdev-tasks-1.git","svn_url":"https://github.com/urfu-2015/webdev-tasks-1","homepage":null,"size":5,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":20,"forks":34,"open_issues":20,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/22"},"html":{"href":"https://github.com/urfu-2015/webdev-tasks-1/pull/22"},"issue":{"href":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/issues/22"},"comments":{"href":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/statuses/3a1ae52ecdcc0566d4734606004d318404cec16a"}}}}