Skip to content

Instantly share code, notes, and snippets.

@davetapley
Created July 5, 2016 20:34
Show Gist options
  • Save davetapley/970061908075bfac46dd2f253d3786a4 to your computer and use it in GitHub Desktop.
Save davetapley/970061908075bfac46dd2f253d3786a4 to your computer and use it in GitHub Desktop.
CodeClimate::TestReporter patched to handle the absence of a .git
require 'simplecov'
require 'codeclimate-test-reporter'
module Extensions
module Git
module ClassMethods
def info
{
head: head,
committed_at: committed_at_or_now,
branch: branch_from_git_or_ci,
}
end
def committed_at_or_now
committed_at || Time.now.to_i
end
end
end
end
CodeClimate::TestReporter::Git.singleton_class.prepend Extensions::Git::ClassMethods
CodeClimate::TestReporter::Formatter.new.format SimpleCov.result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment