{"action":"created","comment":{"url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/pulls/comments/202585395","pull_request_review_id":137312869,"id":202585395,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMjU4NTM5NQ==","diff_hunk":"@@ -0,0 +1,231 @@\n+require 'io/console'\n+require 'optparse'\n+require 'russian_obscenity/base'\n+\n+# 1st tas\n+class TopBadWords\n+  def initialize(number)\n+    foul_language(number)\n+  end\n+\n+  def foul_language(number)\n+    find_members_name\n+    sort_result(@members)\n+    result_output(number)\n+  end\n+\n+  def result_output(number)\n+    number.to_i.times do |i|\n+      printf(\"%-25s \", @members[i][:name])\n+      printf(\"| %-2d battles \", @members[i][:battles])\n+      printf(\"| %-4d  total bad words \", @members[i][:bad_words])\n+      printf(\"| %-3.2f  bad words per battle \", @members[i][:average_number_of_words_in_the_battle])\n+      printf(\"| %-4d  words per round\\n\", @members[i][:words_per_round])\n+    end\n+  end\n+\n+  def sort_result (arr)\n+    arr.sort_by! { |k| k[:bad_words] * -1 }\n+  end\n+\n+  def find_members_name\n+    @members = []\n+    Dir.foreach(\"versus-battle\") do |file| \n+      for_delete = file[/\\s{1}(против|vs|VS){1}\\s{1}.+\\z/]\n+      member_name = file.chomp(for_delete)\n+      verification_of_existence(member_name, file)\n+    end\n+  end\n+\n+  def verification_of_existence(member_name, file)\n+    return member_name if member_name == '.' || member_name == '..'\n+    new_member(member_name) if search_in_bad_words_array(member_name).nil?\n+    temp = @members.index(search_in_bad_words_array(member_name))\n+    add_info(@members[temp], file)\n+  end\n+\n+  def search_in_bad_words_array(member_name)\n+    @members.detect { |mem| mem[:name] == member_name}\n+  end\n+\n+  def new_member(member_name)\n+    member = {}\n+    member[:name] = member_name\n+    member[:battles] = 0 \n+    member[:bad_words] = 0\n+    member[:average_number_of_words_in_the_battle] = 0\n+    member[:words_per_round] = 0\n+    member[:rounds] = 0\n+    @members << member\n+  end\n+\n+  def add_info(member, file)\n+    member[:battles] += 1\n+    member[:rounds] += 1\n+    find_bad_words(member, file)\n+    battle_analysis(member, file)\n+  end\n+\n+  def find_bad_words(member, file)\n+    Dir.chdir(\"versus-battle\") \n+    IO.foreach(file) do |line|\n+      temp = RussianObscenity.find(line)\n+      member[:bad_words] += temp.size\n+      member[:bad_words] += 1 unless (/[\\*]/ =~ line).nil?\n+    end\n+  end\n+\n+  def bad_words_initialize\n+    @bad_words = []\n+    IO.foreach(\"bad_words\") do |line|\n+      @bad_words << line.scan(/[А-яёA-z\\d]{2,}[^\\s,]*/)\n+    end\n+    @bad_words.flatten!\n+  end\n+\n+  def battle_analysis(member, file)\n+    round_counter = 1\n+    word_per_battle = []\n+    IO.foreach(file) do |line|\n+      rounds_counter(member, line) \n+      word_per_battle << words_counter_at_the_tail(line)\n+    end\n+    word_per_battle.flatten!\n+    words_number_in_battle(member, word_per_battle)\n+    words_number_in_rounds(member, word_per_battle)\n+    Dir.chdir('..')\n+  end\n+\n+  def words_number_in_battle(member, words_array)\n+    number = words_array.size\n+    if member[:average_number_of_words_in_the_battle].zero?\n+      member[:average_number_of_words_in_the_battle] = number / member[:battles] \n+    else \n+      member[:average_number_of_words_in_the_battle] = (number / member[:battles] + member[:average_number_of_words_in_the_battle]) / 2.0 \n+    end\n+  end\n+\n+  def words_counter_at_the_tail(line)\n+    line.scan(/[А-яёA-z]+/)\n+  end\n+\n+  def rounds_counter(member, line)\n+    member[:rounds] += 1 if !line.scan(/^(Раунд \\d+)/).empty?","path":"2211/2/versus_checker.rb","position":113,"original_position":113,"commit_id":"286d4d69ae5e2b47413b76672905c282c4fd889d","original_commit_id":"286d4d69ae5e2b47413b76672905c282c4fd889d","user":{"login":"houndci-bot","id":6697940,"node_id":"MDQ6VXNlcjY2OTc5NDA=","avatar_url":"https://avatars0.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Style/NegatedIf: Favor unless over if for negative conditions.","created_at":"2018-07-16T06:53:58Z","updated_at":"2018-07-16T06:54:00Z","html_url":"https://github.com/rubizza-survival-camp/summer-2018/pull/241#discussion_r202585395","pull_request_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/pulls/241","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/pulls/comments/202585395"},"html":{"href":"https://github.com/rubizza-survival-camp/summer-2018/pull/241#discussion_r202585395"},"pull_request":{"href":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/pulls/241"}}},"pull_request":{"url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/pulls/241","id":201521187,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAxNTIxMTg3","html_url":"https://github.com/rubizza-survival-camp/summer-2018/pull/241","diff_url":"https://github.com/rubizza-survival-camp/summer-2018/pull/241.diff","patch_url":"https://github.com/rubizza-survival-camp/summer-2018/pull/241.patch","issue_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/issues/241","number":241,"state":"open","locked":false,"title":"2211-2","user":{"login":"TanyaAkulich","id":32651409,"node_id":"MDQ6VXNlcjMyNjUxNDA5","avatar_url":"https://avatars1.githubusercontent.com/u/32651409?v=4","gravatar_id":"","url":"https://api.github.com/users/TanyaAkulich","html_url":"https://github.com/TanyaAkulich","followers_url":"https://api.github.com/users/TanyaAkulich/followers","following_url":"https://api.github.com/users/TanyaAkulich/following{/other_user}","gists_url":"https://api.github.com/users/TanyaAkulich/gists{/gist_id}","starred_url":"https://api.github.com/users/TanyaAkulich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TanyaAkulich/subscriptions","organizations_url":"https://api.github.com/users/TanyaAkulich/orgs","repos_url":"https://api.github.com/users/TanyaAkulich/repos","events_url":"https://api.github.com/users/TanyaAkulich/events{/privacy}","received_events_url":"https://api.github.com/users/TanyaAkulich/received_events","type":"User","site_admin":false},"body":"## Номер\r\n2211\r\n\r\n## Номер задания\r\n2\r\n\r\n## Ссылка на видео с демо\r\nhttps://youtu.be/b8fQva3sozY\r\n\r\n## Комментарии\r\n","created_at":"2018-07-15T23:27:19Z","updated_at":"2018-07-16T06:54:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0a73e9e6d719b90d1ccb972d2dda62d155696058","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/pulls/241/commits","review_comments_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/pulls/241/comments","review_comment_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/issues/241/comments","statuses_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/statuses/286d4d69ae5e2b47413b76672905c282c4fd889d","head":{"label":"TanyaAkulich:2","ref":"2","sha":"286d4d69ae5e2b47413b76672905c282c4fd889d","user":{"login":"TanyaAkulich","id":32651409,"node_id":"MDQ6VXNlcjMyNjUxNDA5","avatar_url":"https://avatars1.githubusercontent.com/u/32651409?v=4","gravatar_id":"","url":"https://api.github.com/users/TanyaAkulich","html_url":"https://github.com/TanyaAkulich","followers_url":"https://api.github.com/users/TanyaAkulich/followers","following_url":"https://api.github.com/users/TanyaAkulich/following{/other_user}","gists_url":"https://api.github.com/users/TanyaAkulich/gists{/gist_id}","starred_url":"https://api.github.com/users/TanyaAkulich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TanyaAkulich/subscriptions","organizations_url":"https://api.github.com/users/TanyaAkulich/orgs","repos_url":"https://api.github.com/users/TanyaAkulich/repos","events_url":"https://api.github.com/users/TanyaAkulich/events{/privacy}","received_events_url":"https://api.github.com/users/TanyaAkulich/received_events","type":"User","site_admin":false},"repo":{"id":139883584,"node_id":"MDEwOlJlcG9zaXRvcnkxMzk4ODM1ODQ=","name":"summer-2018","full_name":"TanyaAkulich/summer-2018","owner":{"login":"TanyaAkulich","id":32651409,"node_id":"MDQ6VXNlcjMyNjUxNDA5","avatar_url":"https://avatars1.githubusercontent.com/u/32651409?v=4","gravatar_id":"","url":"https://api.github.com/users/TanyaAkulich","html_url":"https://github.com/TanyaAkulich","followers_url":"https://api.github.com/users/TanyaAkulich/followers","following_url":"https://api.github.com/users/TanyaAkulich/following{/other_user}","gists_url":"https://api.github.com/users/TanyaAkulich/gists{/gist_id}","starred_url":"https://api.github.com/users/TanyaAkulich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TanyaAkulich/subscriptions","organizations_url":"https://api.github.com/users/TanyaAkulich/orgs","repos_url":"https://api.github.com/users/TanyaAkulich/repos","events_url":"https://api.github.com/users/TanyaAkulich/events{/privacy}","received_events_url":"https://api.github.com/users/TanyaAkulich/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TanyaAkulich/summer-2018","description":null,"fork":true,"url":"https://api.github.com/repos/TanyaAkulich/summer-2018","forks_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/forks","keys_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/teams","hooks_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/hooks","issue_events_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/issues/events{/number}","events_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/events","assignees_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/assignees{/user}","branches_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/branches{/branch}","tags_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/tags","blobs_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/git/refs{/sha}","trees_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/statuses/{sha}","languages_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/languages","stargazers_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/stargazers","contributors_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/contributors","subscribers_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/subscribers","subscription_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/subscription","commits_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/commits{/sha}","git_commits_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/git/commits{/sha}","comments_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/comments{/number}","issue_comment_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/issues/comments{/number}","contents_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/contents/{+path}","compare_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/merges","archive_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/downloads","issues_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/issues{/number}","pulls_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/pulls{/number}","milestones_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/milestones{/number}","notifications_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/labels{/name}","releases_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/releases{/id}","deployments_url":"https://api.github.com/repos/TanyaAkulich/summer-2018/deployments","created_at":"2018-07-05T17:56:36Z","updated_at":"2018-07-11T11:16:11Z","pushed_at":"2018-07-16T06:53:48Z","git_url":"git://github.com/TanyaAkulich/summer-2018.git","ssh_url":"git@github.com:TanyaAkulich/summer-2018.git","clone_url":"https://github.com/TanyaAkulich/summer-2018.git","svn_url":"https://github.com/TanyaAkulich/summer-2018","homepage":null,"size":88192,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rubizza-survival-camp:master","ref":"master","sha":"5b27b0cb11a122c46d22061b1ea067d6a84fbf52","user":{"login":"rubizza-survival-camp","id":40864986,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwODY0OTg2","avatar_url":"https://avatars1.githubusercontent.com/u/40864986?v=4","gravatar_id":"","url":"https://api.github.com/users/rubizza-survival-camp","html_url":"https://github.com/rubizza-survival-camp","followers_url":"https://api.github.com/users/rubizza-survival-camp/followers","following_url":"https://api.github.com/users/rubizza-survival-camp/following{/other_user}","gists_url":"https://api.github.com/users/rubizza-survival-camp/gists{/gist_id}","starred_url":"https://api.github.com/users/rubizza-survival-camp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubizza-survival-camp/subscriptions","organizations_url":"https://api.github.com/users/rubizza-survival-camp/orgs","repos_url":"https://api.github.com/users/rubizza-survival-camp/repos","events_url":"https://api.github.com/users/rubizza-survival-camp/events{/privacy}","received_events_url":"https://api.github.com/users/rubizza-survival-camp/received_events","type":"Organization","site_admin":false},"repo":{"id":139868408,"node_id":"MDEwOlJlcG9zaXRvcnkxMzk4Njg0MDg=","name":"summer-2018","full_name":"rubizza-survival-camp/summer-2018","owner":{"login":"rubizza-survival-camp","id":40864986,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwODY0OTg2","avatar_url":"https://avatars1.githubusercontent.com/u/40864986?v=4","gravatar_id":"","url":"https://api.github.com/users/rubizza-survival-camp","html_url":"https://github.com/rubizza-survival-camp","followers_url":"https://api.github.com/users/rubizza-survival-camp/followers","following_url":"https://api.github.com/users/rubizza-survival-camp/following{/other_user}","gists_url":"https://api.github.com/users/rubizza-survival-camp/gists{/gist_id}","starred_url":"https://api.github.com/users/rubizza-survival-camp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubizza-survival-camp/subscriptions","organizations_url":"https://api.github.com/users/rubizza-survival-camp/orgs","repos_url":"https://api.github.com/users/rubizza-survival-camp/repos","events_url":"https://api.github.com/users/rubizza-survival-camp/events{/privacy}","received_events_url":"https://api.github.com/users/rubizza-survival-camp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rubizza-survival-camp/summer-2018","description":null,"fork":false,"url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018","forks_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/forks","keys_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/teams","hooks_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/hooks","issue_events_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/issues/events{/number}","events_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/events","assignees_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/assignees{/user}","branches_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/branches{/branch}","tags_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/tags","blobs_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/git/refs{/sha}","trees_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/statuses/{sha}","languages_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/languages","stargazers_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/stargazers","contributors_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/contributors","subscribers_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/subscribers","subscription_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/subscription","commits_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/commits{/sha}","git_commits_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/git/commits{/sha}","comments_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/comments{/number}","issue_comment_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/issues/comments{/number}","contents_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/contents/{+path}","compare_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/merges","archive_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/downloads","issues_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/issues{/number}","pulls_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/pulls{/number}","milestones_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/milestones{/number}","notifications_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/labels{/name}","releases_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/releases{/id}","deployments_url":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/deployments","created_at":"2018-07-05T15:28:12Z","updated_at":"2018-07-13T18:16:53Z","pushed_at":"2018-07-16T06:53:49Z","git_url":"git://github.com/rubizza-survival-camp/summer-2018.git","ssh_url":"git@github.com:rubizza-survival-camp/summer-2018.git","clone_url":"https://github.com/rubizza-survival-camp/summer-2018.git","svn_url":"https://github.com/rubizza-survival-camp/summer-2018","homepage":null,"size":86792,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":57,"mirror_url":null,"archived":false,"open_issues_count":40,"license":null,"forks":57,"open_issues":40,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/pulls/241"},"html":{"href":"https://github.com/rubizza-survival-camp/summer-2018/pull/241"},"issue":{"href":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/issues/241"},"comments":{"href":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/issues/241/comments"},"review_comments":{"href":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/pulls/241/comments"},"review_comment":{"href":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/pulls/241/commits"},"statuses":{"href":"https://api.github.com/repos/rubizza-survival-camp/summer-2018/statuses/286d4d69ae5e2b47413b76672905c282c4fd889d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"houndci-bot"}}