check

package
v0.0.0-...-a16b010 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoFiles

func GoFiles(dir string) (filenames, skipped []string, err error)

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

func RenameFiles

func RenameFiles(names []string) (err error)

RenameFiles renames the provided filenames to have a ".grc.bk" extension, so they will not be considered in future checks.

func RevertFiles

func RevertFiles(names []string) (err error)

RevertFiles removes the ".grc.bk" extension from files

Types

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 ErrCheck

type ErrCheck struct {
	Dir       string
	Filenames []string
}

ErrCheck is the check for the errcheck command

func (ErrCheck) Description

func (c ErrCheck) Description() string

Description returns the description of gofmt

func (ErrCheck) Name

func (c ErrCheck) Name() string

Name returns the name of the display name of the command

func (ErrCheck) Percentage

func (c ErrCheck) Percentage() (float64, []FileSummary, error)

Percentage returns the percentage of .go files that pass gofmt

func (ErrCheck) Weight

func (c ErrCheck) Weight() float64

Weight returns the weight this check has in the overall average

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 GoFmtNative

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

GoFmtNative runs gofmt via golang's stdlib format pkg

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

func (*FileSummary) AddError

func (fs *FileSummary) AddError(out string) error

AddError adds an Error to FileSummary

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 IneffAssign

type IneffAssign struct {
	Dir       string
	Filenames []string
}

IneffAssign is the check for the ineffassign command

func (IneffAssign) Description

func (g IneffAssign) Description() string

Description returns the description of IneffAssign

func (IneffAssign) Name

func (g IneffAssign) Name() string

Name returns the name of the display name of the command

func (IneffAssign) Percentage

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

Percentage returns the percentage of .go files that pass gofmt

func (IneffAssign) Weight

func (g IneffAssign) 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 existence of a license file

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

type Misspell

type Misspell struct {
	Dir       string
	Filenames []string
}

Misspell is the check for the misspell command

func (Misspell) Description

func (g Misspell) Description() string

Description returns the description of Misspell

func (Misspell) Name

func (g Misspell) Name() string

Name returns the name of the display name of the command

func (Misspell) Percentage

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

Percentage returns the percentage of .go files that pass gofmt

func (Misspell) Weight

func (g Misspell) 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