Giter VIP home page Giter VIP logo

go-coverage's Introduction


go-coverage

Increase code coverage of Go projects

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap

About The Project

The key challenge with large code bases with low test coverage is to prioritize which sections of code to test first.

The standard coverage tools tell about the code coverage percentage and what is covered and uncovered however it doesn't give an input on which functions to cover first and what will be the impact of covering them.

This tool addresses the challenge by providing the sorted list of functions to cover and the impact associated with covering it.

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

You'll need Go installed to use this tool. Here is the installation instructions for Go.

Installation

Via go get

go get -u github.com/gojek/go-coverage

Usage

Prerequisites

Generate the coverage profile for your Go codebase, usually done via

go test ./... -coverprofile=coverage.out

Get lines uncovered greater than 10

go-coverage -f coverage.out --line-filter 10

Get trimmed file names

go-coverage -f coverage.out --line-filter 10 --trim
+-------------------------+-------------------------------------+-----------------+--------+
|          FILE           |              FUNCTION               | UNCOVERED LINES | IMPACT |
+-------------------------+-------------------------------------+-----------------+--------+
| ...ice/config/config.go | RadiusForClosestDriverByServicetype |              26 |    1.9 |
| ...ice/config/config.go | RadiusForServicetype                |              26 |    1.9 |
| ...ice/config/config.go | AliceDriverLimit                    |              26 |    1.9 |
| ...ice/config/config.go | ConsumerDriverLimitByServicetype    |              26 |    1.9 |
| .../service/handlers.go | findDriver                          |              19 |    1.4 |
| ...ice/extern/driver.go | driverAllocationStatusFromAPI       |              19 |    1.4 |
| .../service/handlers.go | updateDriverVehicleTags             |              18 |    1.3 |
| ...ice/config/config.go | ConsumerDriverLimit                 |              14 |    1.0 |
| ...vice/service/cron.go | startCrons                          |              14 |    1.0 |
| ...ice/config/config.go | RadiusForVehicleType                |              13 |    0.9 |
| ...ice/config/config.go | matchVehicleType                    |              12 |    0.9 |
| ...rvice/service/api.go | startServer                         |              11 |    0.8 |
+-------------------------+-------------------------------------+-----------------+--------+

Exclude file name pattern

go-coverage -f coverage.out --exclude ".*config.*" --line-filter 10 --trim
+-------------------------+-------------------------------+-----------------+--------+
|          FILE           |           FUNCTION            | UNCOVERED LINES | IMPACT |
+-------------------------+-------------------------------+-----------------+--------+
| .../service/handlers.go | findDriver                    |              19 |    1.4 |
| ...ice/extern/driver.go | driverAllocationStatusFromAPI |              19 |    1.4 |
| .../service/handlers.go | updateDriverVehicleTags       |              18 |    1.3 |
| ...vice/service/cron.go | startCrons                    |              14 |    1.0 |
| ...rvice/service/api.go | startServer                   |              11 |    0.8 |
+-------------------------+-------------------------------+-----------------+--------+

Roadmap

  • Support generation of HTML
  • Integrate with gitlab

go-coverage's People

Contributors

prathik avatar

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.