engine

package
v0.0.0-...-29a47cd Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2017 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsPath

func AbsPath(path string) string

AbsPath is a function that will get absolute path of file.

func DirList

func DirList(projectPath string, suffix, except string) (dirs map[string]string, err error)

DirList is a function that traverse the file directory containing the specified file format according to the specified rule.

func ExceptPkg

func ExceptPkg(pkg string) bool

ExceptPkg is a function that will determine whether the package is an exception.

func PackageAbsPath

func PackageAbsPath(path string) (packagePath string)

PackageAbsPath will gets the absolute path of the specified package from GOPATH's [src].

func PackageAbsPathExceptSuffix

func PackageAbsPathExceptSuffix(path string) (packagePath string)

PackageAbsPath will gets the absolute directory path of the specified file from GOPATH's [src].

func ProjectName

func ProjectName(projectPath string) (project string)

ProjectName is a function that gets project's name.

Types

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 InitConfig

type InitConfig struct {
	ProjectPath           string
	ExceptPackages        string
	LintersProcessChans   chan int64
	LintersFinishedSignal chan string
	StartTime             time.Time
}

type Metric

type Metric struct {
	Name        string             `json:"name"`
	Description string             `json:"description"`
	Summaries   map[string]Summary `json:"summaries"`
	Weight      float64            `json:"weight"`
	Percentage  float64            `json:"percentage"`
	Error       string             `json:"error"`
}

Metric as template of report and will save all linters result data.But may have some difference in different linter.

type PackageTest

type PackageTest struct {
	IsPass   bool    `json:"is_pass"`
	Coverage string  `json:"coverage"`
	Time     float64 `json:"time"`
}

PackageTest is an intermediate variables.

type Reporter

type Reporter struct {
	Project   string            `json:"project"`
	Score     int               `json:"score"`
	Grade     int               `json:"grade"`
	Metrics   map[string]Metric `json:"metrics"`
	Issues    int               `json:"issues"`
	TimeStamp string            `json:"time_stamp"`
	// contains filtered or unexported fields
}

Reporter is the top struct of GoReporter.

func NewReporter

func NewReporter(eic InitConfig) *Reporter

NewReporter will initialize a Reporter struct and return address of the struct which is safe for use.

func (*Reporter) Engine

func (r *Reporter) Engine()

Engine is a important function of goreporter, it will run all linters and rebuild metrics data in a golang prohject. And all linters' result will be as one metric data for Reporter.

func (*Reporter) FormateReport2Json

func (r *Reporter) FormateReport2Json() []byte

FormateReport2Json will marshal struct Reporter into json and return a []byte data.

type Summary

type Summary struct {
	Name        string  `json:"name"`
	Description string  `json:"description"`
	Errors      []Error `json:"errors"`
}

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

type WaitGroupWrapper

type WaitGroupWrapper struct {
	sync.WaitGroup
}

WaitGroupWrapper is a struct that as a waiter for all linetr-tasks.And it encapsulates sync.WaitGroup that can be call as a interface.

func (*WaitGroupWrapper) Wrap

func (w *WaitGroupWrapper) Wrap(cb func())

Wrap implements a interface that run the function cd as a goroutine.And it encapsulates Add(1) and Done() operation.You can just think go cd() but not worry about synchronization and security issues.

Jump to

Keyboard shortcuts

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