Documentation ¶
Index ¶
- func DisplayAsText(jsonData []byte)
- func SaveAsHtml(htmlData HtmlData, projectPath, savePath, timestamp, tpl string)
- func SaveAsJson(jsonData []byte, projectPath, savePath, timestamp string)
- type Copycode
- type Cyclo
- type CycloInfo
- type Cycloi
- type Deadcode
- type File
- type HtmlData
- type PackageTest
- type Race
- type Scan
- type Simple
- type Spell
- type Test
- type UnitTest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisplayAsText ¶
func DisplayAsText(jsonData []byte)
DisplayAsText will display the json data to console.In your CI, all the tips will be given a variety of color tips, very beautiful.
func SaveAsHtml ¶
SaveAsHtml is a function that save HtmlData as a html report.And will receive htmlData, projectPath, savePath and tpl parameters.
func SaveAsJson ¶
SaveAsJson is a function that save data as a json report.And will receive jsonData, projectPath, savePath and timestamp parameters.
Types ¶
type Copycode ¶
Copycode is a struct that contains Files and Path. The type of Path MUST []string that contains more than one file path. The Copycode represents some copyed code information.
type Cyclo ¶
Cyclo is a struct that contains Pkg, Size and Info. The type of Info MUST []CycloInfo that represents detail information of all function.
type CycloInfo ¶
CycloInfo is a struct that contains Comp and Info. The type of Comp MUST int that represents the cyclo of one function.The CycloInfo represents one cyclo function information.
type Cycloi ¶
Cycloi is a struct that contains Average and Result. The Average is one package's cyclo coverage. And Result is the detail cyclo of the package's all function.
type Deadcode ¶
Deadcode is a struct that contains Path and Info. The type of Path and Info MUST string. The Deadcode represents one dead code.
type File ¶
File is a struct that contains Color, CycloVal and CycloInfo. And it is just for one file's display. The CycloInfo contains all cyclo detail information.
type HtmlData ¶
type HtmlData struct { Project string Score int Tests string Date string Issues int FileCount int CodeLines int CommentLines int TotalLines int TestSummaryCoverAvg string AveragePackageCover float64 SimpleIssues int DeadcodeIssues int CycloBigThan15 int Races []Race NoTests string Simples string Spells string SimpleLevel int Deadcodes string Copycodes string Cyclos string DepGraph template.HTML LastRefresh time.Time `json:"last_refresh"` HumanizedLastRefresh string `json:"humanized_last_refresh"` }
UnitTest is a struct that contains some features in a report of html.
GoReporter HTML Report Features +----------------------------------------------------------------------+ | Feature | Information | +=======================+==============================================+ | Project | The path address of the item being detected | +-----------------------+----------------------------------------------+ | Score | The score of the tested project | +-----------------------+----------------------------------------------+ | Tests | Unit test results | +-----------------------+----------------------------------------------+ | Date | Date assessment of the project | +-----------------------+----------------------------------------------+ | Issues | Issues number of the project | +-----------------------+----------------------------------------------+ | FileCount | Go file number of the peoject | +-----------------------+----------------------------------------------+ | CodeLines | Number of lines of code | +-----------------------+----------------------------------------------+ | CommentLines | Number of lines of Comment | +-----------------------+----------------------------------------------+ | TestSummaryCoverAvg | Code cover average of all unit test | +-----------------------+----------------------------------------------+ | AveragePackageCover | Package cover average of all packages | +-----------------------+----------------------------------------------+ | SimpleIssues | Simpled issues number | +-----------------------+----------------------------------------------+ | DeadcodeIssues | Dead code issues number | +-----------------------+----------------------------------------------+ | CycloBigThan15 | Cyclo more than 15 number | +-----------------------+----------------------------------------------+ | Races | Race result of all packages | +-----------------------+----------------------------------------------+ | NoTests | No unit test packages information | +-----------------------+----------------------------------------------+ | Simples | Simpled cases of all packages information | +-----------------------+----------------------------------------------+ | SimpleLevel | Simple level of path | +-----------------------+----------------------------------------------+ | Deadcodes | Dead code cases information | +-----------------------+----------------------------------------------+ | Copycodes | Copy code cases information | +-----------------------+----------------------------------------------+ | Cyclos | Cyclo of funtion cases information | +-----------------------+----------------------------------------------+ | DepGraph | Depend graph of all packages in the project | +-----------------------+----------------------------------------------+ | LastRefresh | Last refresh time of one project | +-----------------------+----------------------------------------------+ | HumanizedLastRefresh | Humanized last refresh setting | +-----------------------+----------------------------------------------+
And the HtmlData just as data for default html template. If you want to customize your own template file, please follow these data, or you can redefine it yourself.
type PackageTest ¶
type PackageTest struct { IsPass bool `json:"is_pass"` Coverage string `json:"coverage"` Time float64 `json:"time"` }
PackageTest is a struct that contains IsPass, Coverage and Time. The type of Time MUST float64.
type Race ¶
Race is a struct that contains Pkg, Len, Leng and Info. The type of Info MUST []string that represents more than one race case. Len is the number of cases.
type Scan ¶
Scan is a struct that contains Path and Info. The type of Path and Info MUST string. The Scan represents one defect case.
type Simple ¶
Simple is a struct that contains Path and Info. The type of Path and Info MUST string. The Simple represents one can be simpled code case.
type Spell ¶
Spell is a struct that contains Path and Info. The type of Path and Info MUST string. The Spell represents one word is misspelled.
type Test ¶
Test is a struct that contains Path, Result, Time and Cover. The type of Time and Cover MUST float64. And it is just for one package's display.
type UnitTest ¶
type UnitTest struct { AvgCover string `json:"average_cover"` PackagesTestDetail map[string]PackageTest `json:"packages_test_detail"` PackagesRaceDetail map[string][]string `json:"packages_race_detail"` }
UnitTest is a struct that contains AvgCover, PackagesTestDetail and PackagesRaceDetail. The type of AvgCover MUST string that represents the code coverage of the entire project. The type of PackagesTestDetail MUST map[string]PackageTest(contains pass-status,code-coverage and time). and it has all packages' detail infomation. PackagesRaceDetail contains all packages' race cases.
And the UnitTest contains all packages' result.