Skip to content

Instantly share code, notes, and snippets.

@henrich-m
Last active February 16, 2018 19:09
Show Gist options
  • Save henrich-m/9ff61d98d246ae9bdb6d3e78885c1408 to your computer and use it in GitHub Desktop.
Save henrich-m/9ff61d98d246ae9bdb6d3e78885c1408 to your computer and use it in GitHub Desktop.
Top 10 Issues in Rubocop
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 }
.last(30)
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