utils

package
v0.0.0-...-e2e2fe3 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2019 License: Apache-2.0 Imports: 6 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 CountPercentage

func CountPercentage(issues int) float64

CountPercentage will count all linters' percentage.And rule is

+--------------------------------------------------+
|   issues    |               score                |
+==================================================+
| 5           | 100-issues*2                       |
+--------------------------------------------------+
| [5,10)      | 100 - 10 - (issues-5)*4            |
+--------------------------------------------------+
| [10,20)     | 100 - 10 - 20 - (issues-10)*5      |
+--------------------------------------------------+
| [20,40)     | 100 - 10 - 20 - 50 - (issues-20)*1 |
+--------------------------------------------------+
| [40,*)      | 0                                  |
+--------------------------------------------------+

It will return a float64 type score.

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 FileList

func FileList(projectPath string, suffix, except string) (files []string, err error)

FileList is a function that traverse the file is the specified file format according to the specified rule.

func GetProcessUnit

func GetProcessUnit(sumProcessNumber int64, number int) int64

GetProcessUnit provides function that will get sumProcessNumber of linter's weight and the number of current linter's case.It will return 1 if sumProcessNumber/int64(number) <= 0 or sumProcessNumber / int64(number). Just for communication.

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 PackageNameFromGoPath

func PackageNameFromGoPath(path string) string

PackageNameFromGoPath is a function that will get package's name from GOPATH.

func ProjectName

func ProjectName(projectPath string) (project string)

ProjectName is a function that gets project's name.

Types

This section is empty.

Jump to

Keyboard shortcuts

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