check

package
v0.0.0-...-d1ce119 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2015 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoFiles

func GoFiles(dir string) ([]string, error)

GoFiles returns a slice of Go filenames in a given directory.

Types

type ByFilename

type ByFilename []FileSummary

ByFilename implements sort.Interface for []Person based on the Age field.

func (ByFilename) Len

func (a ByFilename) Len() int

func (ByFilename) Less

func (a ByFilename) Less(i, j int) bool

func (ByFilename) Swap

func (a ByFilename) Swap(i, j int)

type Check

type Check interface {
	Name() string
	Description() string
	Weight() float64
	// Percentage returns the passing percentage of the check,
	// as well as a map of filename to output
	Percentage() (float64, []FileSummary, error)
}

Check describes what methods various checks (gofmt, go lint, etc.) should implement

type Error

type Error struct {
	LineNumber  int    `json:"line_number"`
	ErrorString string `json:"error_string"`
}

Error contains the line number and the reason for an error output from a command

type FileSummary

type FileSummary struct {
	Filename string  `json:"filename"`
	FileURL  string  `json:"file_url"`
	Errors   []Error `json:"errors"`
}

FileSummary contains the filename, location of the file on GitHub, and all of the errors related to the file

func GoTool

func GoTool(dir string, filenames, command []string) (float64, []FileSummary, error)

GoTool runs a given go command (for example gofmt, go tool vet) on a directory

type GoCyclo

type GoCyclo struct {
	Dir       string
	Filenames []string
}

GoCyclo is the check for the go cyclo command

func (GoCyclo) Description

func (g GoCyclo) Description() string

Description returns the description of GoCyclo

func (GoCyclo) Name

func (g GoCyclo) Name() string

Name returns the name of the display name of the command

func (GoCyclo) Percentage

func (g GoCyclo) Percentage() (float64, []FileSummary, error)

Percentage returns the percentage of .go files that pass gofmt

func (GoCyclo) Weight

func (g GoCyclo) Weight() float64

Weight returns the weight this check has in the overall average

type GoFmt

type GoFmt struct {
	Dir       string
	Filenames []string
}

GoFmt is the check for the go fmt command

func (GoFmt) Description

func (g GoFmt) Description() string

Description returns the description of gofmt

func (GoFmt) Name

func (g GoFmt) Name() string

Name returns the name of the display name of the command

func (GoFmt) Percentage

func (g GoFmt) Percentage() (float64, []FileSummary, error)

Percentage returns the percentage of .go files that pass gofmt

func (GoFmt) Weight

func (g GoFmt) Weight() float64

Weight returns the weight this check has in the overall average

type GoLint

type GoLint struct {
	Dir       string
	Filenames []string
}

GoLint is the check for the go lint command

func (GoLint) Description

func (g GoLint) Description() string

Description returns the description of go lint

func (GoLint) Name

func (g GoLint) Name() string

Name returns the name of the display name of the command

func (GoLint) Percentage

func (g GoLint) Percentage() (float64, []FileSummary, error)

Percentage returns the percentage of .go files that pass golint

func (GoLint) Weight

func (g GoLint) Weight() float64

Weight returns the weight this check has in the overall average

type GoVet

type GoVet struct {
	Dir       string
	Filenames []string
}

GoVet is the check for the go vet command

func (GoVet) Description

func (g GoVet) Description() string

Description returns the description of go lint

func (GoVet) Name

func (g GoVet) Name() string

Name returns the name of the display name of the command

func (GoVet) Percentage

func (g GoVet) Percentage() (float64, []FileSummary, error)

Percentage returns the percentage of .go files that pass go vet

func (GoVet) Weight

func (g GoVet) Weight() float64

Weight returns the weight this check has in the overall average

type License

type License struct {
	Dir       string
	Filenames []string
}

License is the check for the go cyclo command

func (License) Description

func (g License) Description() string

Description returns the description of License

func (License) Name

func (g License) Name() string

Name returns the name of the display name of the command

func (License) Percentage

func (g License) Percentage() (float64, []FileSummary, error)

Percentage returns 0 if no LICENSE, 1 if LICENSE

func (License) Weight

func (g License) Weight() float64

Weight returns the weight this check has in the overall average

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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