qax-os / goreporter

A Golang tool that does static analysis, unit testing, code review and generate code quality report.
Apache License 2.0
3.13k stars 273 forks source link

fixed the vet check issues and depend root issue #63

Closed fearblackcat closed 6 years ago

fearblackcat commented 6 years ago

Fixed two issues

1) Fixed the vet issues

before fixed vet issues

$ gometalinter --deadline=180s --disable-all --enable=vet ./goreporter/... goreporter/engine/reporter.go:130::error: call of strategy.Percentage copies lock value: engine.Summaries (vet) goreporter/engine/strategy_copycheck.go:70::error: Percentage passes lock by value: engine.Summaries (vet) goreporter/engine/strategy_countcode.go:46::error: Percentage passes lock by value: engine.Summaries (vet) goreporter/engine/strategy_cyclo.go:79::error: Percentage passes lock by value: engine.Summaries (vet) goreporter/engine/strategy_deadcode.go:67::error: Percentage passes lock by value: engine.Summaries (vet) goreporter/engine/strategy_dependgraph.go:38::error: Percentage passes lock by value: engine.Summaries (vet) goreporter/engine/strategy_depth.go:75::error: Percentage passes lock by value: engine.Summaries (vet) goreporter/engine/strategy_gofmt.go:64::error: return copies lock value: engine.Summaries (vet) goreporter/engine/strategy_gofmt.go:67::error: Percentage passes lock by value: engine.Summaries (vet) goreporter/engine/strategy_golint.go:65::error: return copies lock value: engine.Summaries (vet) goreporter/engine/strategy_golint.go:68::error: Percentage passes lock by value: engine.Summaries (vet) goreporter/engine/strategy_govet.go:69::error: return copies lock value: engine.Summaries (vet) goreporter/engine/strategy_govet.go:72::error: Percentage passes lock by value: engine.Summaries (vet) goreporter/engine/strategy_importpackages.go:39::error: Percentage passes lock by value: engine.Summaries (vet) goreporter/engine/strategy_interfacer.go:67::error: Percentage passes lock by value: engine.Summaries (vet) goreporter/engine/strategy_simplecode.go:62::error: return copies lock value: engine.Summaries (vet) goreporter/engine/strategy_simplecode.go:65::error: Percentage passes lock by value: engine.Summaries (vet) goreporter/engine/strategy_spellcheck.go:65::error: Percentage passes lock by value: engine.Summaries (vet) goreporter/engine/strategy_unittest.go:96::error: Percentage passes lock by value: engine.Summaries (vet) goreporter/linters/interfacer/interfacer.go:21::error: first argument to Println is os.Stderr (vet) goreporter/linters/interfacer/testdata/files/dereference.go:11::error: Wrong passes lock by value: foo.st (vet) goreporter/linters/interfacer/testdata/files/noniface_usage.go:10::error: result of (foo.mint).String call not used (vet) goreporter/linters/interfacer/testdata/files/noniface_usage.go:15::error: result of (foo.mint).String call not used (vet) ...

after fixed issues:

$ gometalinter --deadline=180s --disable-all --enable=vet ./goreporter/... goreporter/linters/interfacer/testdata/files/dereference.go:11::error: Wrong passes lock by value: foo.st (vet) goreporter/linters/interfacer/testdata/files/noniface_usage.go:10::error: result of (foo.mint).String call not used (vet) goreporter/linters/interfacer/testdata/files/noniface_usage.go:15::error: result of (foo.mint).String call not used (vet) goreporter/linters/interfacer/testdata/files/noniface_usage.go:20::error: result of (foo.mint).String call not used (vet) ....

2) Fixed the depend issues:

It will cause to check the depend path only in the work dir not in the project path for vendor if you pass the local path under the GOPATH. e.g: $ cd GOPATH/git.cloudware.com/GROUP-NAME $goreporter -p ./PROJECT-NAME -r ./ -f html 2018/05/07 04:34:29 Linter:Deadcode over,time consuming 0.639470244s E0507 04:34:31.952739 16267 depend.go:81] failed to import git.cloudware.com/xxx/goxx: cannot find package "vendor/git.cloudware.com/xxx/goxx" in any of: /usr/local/go/src/vendor/git.cloudware.com/xxx/goxx (from $GOROOT) /Users/fearblackcat/golang/src/vendor/git.cloudware.com/xxx/goxx (from $GOPATH) Actually, the package is already in the vendor of project directory. So I fixed this problem.

codecov-io commented 6 years ago

Codecov Report

Merging #63 into master will not change coverage. The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #63   +/-   ##
=======================================
  Coverage   31.86%   31.86%           
=======================================
  Files          18       18           
  Lines        1274     1274           
=======================================
  Hits          406      406           
  Misses        829      829           
  Partials       39       39
Impacted Files Coverage Δ
engine/strategy_depth.go 0% <0%> (ø) :arrow_up:
engine/strategy_golint.go 0% <0%> (ø) :arrow_up:
engine/strategy_gofmt.go 0% <0%> (ø) :arrow_up:
engine/strategy_dependgraph.go 0% <0%> (ø) :arrow_up:
engine/strategy_govet.go 0% <0%> (ø) :arrow_up:
engine/strategy_countcode.go 0% <0%> (ø) :arrow_up:
engine/strategy_spellcheck.go 0% <0%> (ø) :arrow_up:
engine/reporter.go 65.11% <0%> (ø) :arrow_up:
engine/strategy_deadcode.go 0% <0%> (ø) :arrow_up:
engine/strategy_cyclo.go 0% <0%> (ø) :arrow_up:
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 406f87a...ef9a5d1. Read the comment docs.

wgliang commented 6 years ago

Great patch.

wgliang commented 6 years ago

fix issue #61