Skip to content

Commit

Permalink
Merge pull request #17 from wgliang/feature-single
Browse files Browse the repository at this point in the history
Feature single merge master into goreporter2.0
  • Loading branch information
wgliang authored May 17, 2017
2 parents 9651629 + 0df6d34 commit 0959d2f
Show file tree
Hide file tree
Showing 66 changed files with 4,318 additions and 3,300 deletions.
31 changes: 3 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ A Golang tool that does static analysis, unit testing, code review and generate
- [Credits](#credits)
- [Quickstart](#quickstart)
- [Example](#example)
- [Summary](#summary)
- [UnitTest](#unittest)
- [SimpleCode](#simplecode)
- [DeadCode & CopyCode](#deadcodeandcopycode)
- [Cyclo](#cyclo)
- [Report-example](#report-example)
- [Credits](#credits)

Expand Down Expand Up @@ -93,31 +88,11 @@ By default, the default template is used to generate reports in html format.
```
$ goreporter -p ../goreporter -r ../goreporter -t ./templates/template.html
```
you can see result detail:[Example-Report](http://fiisio.me/pages/goreporter-report.html)
you can see result detail:[online-example-report](http://fiisio.me/pages/goreporter-report.html)

### Summary
![summary](./doc/summary.jpeg)
example:github.com/wgliang/logcool

### UnitTest
![unittest](./doc/unittest_time.jpeg)

![unittest](./doc/unittest_cover.jpeg)

### SimpleCode
![simplecode](./doc/simplecode.jpeg)

### DeadCode
![deadcode](./doc/copycode.jpeg)

### CopyCode
![copycode](./doc/copycode.jpeg)

### Cyclo
![cyclo](./doc/cyclo.jpeg)

## Report-example

[Example-Report](http://fiisio.me/pages/goreporter-report.html)
![github.com/wgliang/logcool](./doc/github-com-wgliang-goreporter-logcool.png)

## Credits

Expand Down
Binary file added doc/github-com-wgliang-goreporter-logcool.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
148 changes: 28 additions & 120 deletions engine/config.go
Original file line number Diff line number Diff line change
@@ -1,129 +1,37 @@
package engine

import (
"html/template"
)

type Reporter struct {
Project string `json:"project"`
Score int `json:"score"`
UnitTestx UnitTest `json:"unit_test"`
Cyclox map[string]Cycloi `json:"cyclo"`
SimpleTips map[string][]string `json:"simple_tips"`
CopyTips [][]string `json:"copy_tips"`
ScanTips map[string][]string `json:"scan_tips"`
DependGraph string `json:"depend_graph"`
DeadCode []string `json:"dead_code"`
NoTestPkg []string `json:"no_test_package"`
SpellError []string `json:"spell_error"`
}

type UnitTest struct {
AvgCover string `json:"average_cover"`
PackagesTestDetail map[string]PackageTest `json:"packages_test_detail"`
PackagesRaceDetail map[string][]string `json:"packages_race_detail"`
// Error contains the line number and the reason for
// an error output from a command
type Error struct {
LineNumber int `json:"line_number"`
ErrorString string `json:"error_string"`
}

type PackageTest struct {
IsPass bool `json:"is_pass"`
Coverage string `json:"coverage"`
Time float64 `json:"time"`
// FileSummary contains the filename, location of the file
// on GitHub, and all of the errors related to the file
type Summary struct {
Name string `json:"name"`
Description string `json:"description"`
Errors []Error `json:"errors"`
}

type Cycloi struct {
Average string
Result []string
// Metric as template of report and will save all linters result
// data.But may have some diffreence in diffrent linter.
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"`
}

type Test struct {
Path string
Result int
Time float64
Cover float64
}

type File struct {
Color string
CycloVal string
CycloInfo string
}

type Copycode struct {
Files string
Path []string
}

type Race struct {
Pkg string
Len string
Leng string
Info []string
}

type Simple struct {
Path string
Info string
}

type Scan struct {
Path string
Info string
}

type Deadcode struct {
Path string
Info string
}
type CycloInfo struct {
Comp int
Info string
}
type Cyclo struct {
Pkg string
Size int
Info []CycloInfo
}

type HtmlData struct {
Project string
Score int
Tests string
TestSummaryCoverAvg string
Races []Race
NoTests string
Simples string
SimpleLevel int
Deadcodes string
Copycodes string
Cyclos string
CycloSummarysCycloAvg string
CycloSummarysCyclo50 string
CycloSummarysCyclo15 string
DepGraph template.HTML
}

type ApolloMeta struct {
Branch string `json:"branch"`
Project string `json:"project"`
CommitID string `json:"commitid"`
CommitUser string `json:"commituser"`
User string `json:"user"`
UnintTestCover string `json:"uninttestcover"`
StaticCheck string `json:"staticcheck"`
CycloBig string `json:"cyclobig"`
Score int `json:"score"`
Starttime string `json:"starttime"`
Endtime string `json:"endtime"`
// Reporter is the top struct of GoReporter.
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"`
}

// type OptionMeta struct {
// Branch string `json:"branch"`
// CommitID string `json:"commitID"`
// CommitUser string `json:"commitUser"`
// User string `json:"user"`
// }

// type Value struct {
// Filepath string `json:"filepath"`
// Meta ApolloMeta `json:"meta"`
// }
Loading

0 comments on commit 0959d2f

Please sign in to comment.