Skip to content

Instantly share code, notes, and snippets.

@evizitei
Created December 17, 2014 04:07
Show Gist options
  • Save evizitei/9a53c0f043a928128c70 to your computer and use it in GitHub Desktop.
Save evizitei/9a53c0f043a928128c70 to your computer and use it in GitHub Desktop.
quick&dirty script for finding commits where tests weren't done
require 'rubygems'
dir = '/Users/evizitei/Code/instructure/canvas-lms'
Dir.chdir dir
shas =`git log --oneline --since='4 weeks ago' | cut -f 1 -d ' '`
def is_a_problem?(sha)
files = (`git diff --name-only #{sha} #{sha}~1`)
((files =~ /^(app|public).*\.(coffee|js)$/ &&
!(files =~ /^spec.*\.(coffee|js)$/)) ||
(files =~ /^(app|lib).*\.rb$/ && !(files =~ /^spec.*\.rb$/) ))
end
problems = shas.split(/\n/).select{|sha| is_a_problem?(sha) }
puts "FOUND #{problems.count} problems"
File.open("problems.txt", 'w') do |f|
problems.each{|p| f << p << "\n"}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment