No commit activity in last 3 years
No release in over 3 years
Simple gem that uploads coverage data from a CI server; also handles submissions from parallelized runs.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0
>= 0

Runtime

>= 0.7
 Project Readme

Scrutinizer Ocular

Uploads Ruby code coverage data to scrutinizer-ci.com. Internally, it relies on SimpleCov.

Installation

Add this line to your application's Gemfile:

gem 'scrutinizer-ocular'

And then execute:

$ bundle

Or install it yourself as:

$ gem install scrutinizer-ocular

Usage

You need to initialize ocular at the very top of your test_helper.rb or spec_helper.rb file before loading any of your code:

# test_helper.rb or spec_helper.rb
require 'scrutinizer/ocular'
Scrutinizer::Ocular.watch!

When running your tests on a private repository, make sure you have your access token set:

SCRUTINIZER_ACCESS_TOKEN=abc123 bundle exec rspec spec

When you create an access token, make sure to select READ permission only. Generally, it's a good idea to set-up a dedicated user for reporting code coverage only.

Advanced Use-Cases

Defining the SimpleCov Profile

If you would like to have SimpleCov use a specific profile, you can pass it to the watch method:

Scrutinizer::Ocular.watch! 'rails'

Adding additional Formatters

If you would like to run other formatters apart from Scrutinizer's Formatter, you can add these easily:

require 'simplecov'
require 'scrutinizer/ocular'

# To avoid uploading coverage when running tests locally, you can use
# Scrutinizer::Ocular.should_run? and add the formatter conditionally.

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
  SimpleCov::Formatter::HTMLFormatter,
  Scrutinizer::Ocular::UploadFormatter
]
SimpleCov.start

Merging Coverage from Parallelized Runs

Scrutinizer supports merging coverage from parallelized runs natively. All you need to do is adjust your .scrutinizer.yml to tell us how many submissions you are going to make; no further changes are necessary.

Credits

Parts of this code were inspired by the Ruby Coveralls implementation and were received under the MIT license.