Giter VIP home page Giter VIP logo

ocular.rb's Introduction

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.

ocular.rb's People

Contributors

schmittjoh avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ocular.rb's Issues

Code coverage results do not respect :nocov:

SimpleCov allows the use of a token in the source file such as :nocov: which delimits blocks of codes that should not be considered when calculating code coverage. Why I look at the HTML report produced by SimpleCov, lines inside :nocov: blocks are correctly shown as skipped. On Scrutinizer CI, these blocks are displayed in red as not covered.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.