Last active
February 16, 2018 19:09
Revisions
-
henrich-m revised this gist
Feb 16, 2018 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,8 +9,7 @@ top_10 = offenses.group_by { |f| f['cop_name'] } .map { |key, values| [key, values.count] } .sort_by { |_, count| count } .last(30) top_10.each do |cop_name, count| puts "#{cop_name} - #{count}" -
henrich-m revised this gist
Feb 16, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ .map { |key, values| [key, values.count] } .sort_by { |_, count| count } .reverse .first(20) top_10.each do |cop_name, count| puts "#{cop_name} - #{count}" -
henrich-m created this gist
Feb 16, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ require 'json' Kernel.system('rubocop app lib spec -f json -P > rubocop.json') data = JSON.parse(File.read('rubocop.json')) offenses = data['files'].flat_map { |f| f['offenses'] } top_10 = offenses.group_by { |f| f['cop_name'] } .map { |key, values| [key, values.count] } .sort_by { |_, count| count } .reverse .first(10) top_10.each do |cop_name, count| puts "#{cop_name} - #{count}" end