Documentation ¶
Index ¶
- func AbsPath(path string) string
- func DirList(projectPath string, suffix, except string) (dirs map[string]string, err error)
- func ExceptPkg(pkg string) bool
- func PackageAbsPath(path string) (packagePath string)
- func PackageAbsPathExceptSuffix(path string) (packagePath string)
- func ProjectName(projectPath string) (project string)
- type Error
- type InitConfig
- type Metric
- type PackageTest
- type Reporter
- type Summary
- type WaitGroupWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirList ¶
DirList is a function that traverse the file directory containing the specified file format according to the specified rule.
func PackageAbsPath ¶
PackageAbsPath will gets the absolute path of the specified package from GOPATH's [src].
func PackageAbsPathExceptSuffix ¶
PackageAbsPath will gets the absolute directory path of the specified file from GOPATH's [src].
func ProjectName ¶
ProjectName is a function that gets project's name.
Types ¶
type InitConfig ¶
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 ¶
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 ¶
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.