Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jclif/3df2c14e9318e4394f09e010961ff5f6 to your computer and use it in GitHub Desktop.
Save jclif/3df2c14e9318e4394f09e010961ff5f6 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