Skip to content

Instantly share code, notes, and snippets.

@TALlama
Created September 11, 2013 17:52
Show Gist options
  • Save TALlama/6527241 to your computer and use it in GitHub Desktop.
Save TALlama/6527241 to your computer and use it in GitHub Desktop.
Using CodeClimate's coverage reporting alongside an existing formatter.
require "codeclimate-test-reporter"
CodeClimate::TestReporter.start
# output Rcov-style coverage files
require 'simplecov'
require 'simplecov-rcov'
class SimpleCov::Formatter::MergedFormatter
def format(result)
require "codeclimate-test-reporter"
CodeClimate::TestReporter::Formatter.new.format(result)
SimpleCov::Formatter::RcovFormatter.new.format(result)
end
end
SimpleCov.formatter = if ENV['CODECLIMATE_REPO_TOKEN']
SimpleCov::Formatter::MergedFormatter
else
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment