Last active
February 16, 2018 19:09
-
-
Save henrich-m/9ff61d98d246ae9bdb6d3e78885c1408 to your computer and use it in GitHub Desktop.
Top 10 Issues in Rubocop
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 characters
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(20) | |
top_10.each do |cop_name, count| | |
puts "#{cop_name} - #{count}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment