qual

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2018 License: BSD-3-Clause Imports: 6 Imported by: 0

README

Build Status codecov Maintainability

qual - Go package for quality assessment at src level

Quick start

go get github.com/gregoryv/qual

Add a unit test to your project

func Test_CodeQuality(t *testing.T) {
    qual.Standard(t)
}

or use a more custom set of metrics

func Test_CodeQualtiy(t *testing.T) {
    //  < 6 good, ..., > 9 is bad
    CyclomaticComplexity(5, false, t)
    // < 81 good, ..., > 100 is bad
    SourceWidth(80, false, t)
}

If you are really brave, do

func Test_CodeQuality(t *testing.T) {
    qual.High(t)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CyclomaticComplexity

func CyclomaticComplexity(max int, includeVendor bool, t T)

CyclomaticComplexity fails if max is exceeded in any go files of this project.

func High

func High(t T)

High is the same as Standard, only it includes all vendor source as well.

func LineLength

func LineLength(maxChars int, includeVendor bool, t T)

SourceWidth fails if any go file contains lines exceeding maxChars. All lines are considered, source and comments.

func Standard

func Standard(t T)

Standard tests a set of metrics which might be considered necessary for production code. This is very opinionated, but the values are based on community insights from various sources.

Types

type T

type T interface {
	Helper()
	Error(...interface{})
	Errorf(string, ...interface{})
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL