Git Product home page Git Product logo

go-coverage-threshold's Introduction

go-coverage-threshold Build Status

keep your per-path Go test coverage above a threshold

Installation

go get -u github.com/jokeyrhyme/go-coverage-threshold/cmd/go-coverage-threshold

Usage

$ go-coverage-threshold --help

Usage of go-coverage-threshold:
  -t float
        threshold that coverage must exceed (shorthand) (default 80)
  -threshold float
        threshold that coverage must exceed (default 80)

go-coverage-threshold will internally execute go test -cover ./... for you

If any of your ./... paths (paths that contain .go files) have a test coverage percentage that is below the threshold, then it exits with a non-zero exit code

This is useful for Continuous Integration workflows where you want to maintain and encourage test coverage

Configuration

You may place a .cover.toml file at the root of your project, as an alternative to using command line arguments, e.g:

# important: specify "50.0" if you want 50% coverage,
# "50" without the ".0" will not work
threshold = 50.0

Note that command line arguments take precedence over configuration files

Note that .cover.toml files in sub-directories take precedence over parent directories, so you may have a threshold for the whole project as a rule, yet define exceptions for certain sub-directories, e.g:

  • PROJECT_ROOT/.cover.toml: threshold = 80.0
  • PROJECT_ROOT/cmd/.cover.toml: threshold = 10.0

go-coverage-threshold's People

Contributors

ithildir avatar jokeyrhyme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

go-coverage-threshold's Issues

run `-race` by default, option to disable this

We should encourage more thorough data-race testing by adding the -race flag when we call go test

I don't want to introduce this change without a way to disable it though, just in case there's a valid use case for it

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.