Created
January 21, 2011 21:16
-
-
Save lukemelia/790441 to your computer and use it in GitHub Desktop.
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
namespace :analyze do | |
namespace :commits do | |
desc 'Flog the most commonly revised files in the git history' | |
task :most_changed_files do | |
counts = Hash.new(0) | |
IO.popen("PAGER=cat git log --name-only --pretty=oneline 2>&1") do |pipe| | |
while (!pipe.eof) do | |
line = pipe.readline | |
next unless line =~ /^(app|lib).*\.rb$/ | |
counts[line.chomp] += 1 | |
end | |
end | |
counts.sort_by{|item| item.last}.reverse.first(15).each do |item| | |
flog_score = `flog -s #{item.first}`.to_f.round | |
puts "#{item.first} (in #{item.last} commits) (Flog: #{flog_score})" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment