Preparing report...

Report for github.com/uber-common/cpustat

A+    Excellent!    Found 16 issues across 24 files

Tweet

gofmt95%

Gofmt formats Go programs. We run gofmt -s on your code, where -s is for the "simplify" command


go_vet100%

go vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.

No problems detected. Good job!


gocyclo83%

Gocyclo calculates cyclomatic complexities of functions in Go source code. The cyclomatic complexity of a function is calculated according to the following rules: 1 is the base complexity of a function +1 for each 'if', 'for', 'case', '&&' or '||' Go Report Card warns on functions with cyclomatic complexity > 15.

    • cpustat/lib/filters_test.go
    • Line 108: warning: cyclomatic complexity 20 of function TestFiltersUsers() is high (> 15) (gocyclo)
    • Line 40: warning: cyclomatic complexity 19 of function TestFiltersPids() is high (> 15) (gocyclo)

golint54%

Golint is a linter for Go source code.

    • cpustat/lib/filters.go
    • Line 14: warning: comment on exported function ParseUserList should be of the form "ParseUserList ..." (golint)
    • Line 50: warning: exported type Filters should have comment or be unexported (golint)
    • Line 57: warning: exported method Filters.PidMatch should have comment or be unexported (golint)
    • Line 72: warning: exported method Filters.UserMatch should have comment or be unexported (golint)
    • Line 87: warning: exported function FiltersInit should have comment or be unexported (golint)
    • cpustat/lib/proc_stats.go
    • Line 31: warning: exported type ProcSample should have comment or be unexported (golint)
    • Line 37: warning: exported type ProcSampleList should have comment or be unexported (golint)
    • Line 42: warning: exported function NewProcSampleList should have comment or be unexported (golint)
    • Line 49: warning: exported type ProcSampleMap should have comment or be unexported (golint)
    • Line 66: warning: exported type ProcStatsMap should have comment or be unexported (golint)
    • cpustat/lib/proc_stats_seek.go
    • Line 30: warning: exported type ProcStatsSeekReader should have comment or be unexported (golint)
    • Line 36: warning: exported method ProcStatsSeekReader.Initialize should have comment or be unexported (golint)
    • Line 53: warning: exported method ProcStatsSeekReader.ReadStats should have comment or be unexported (golint)
    • Line 80: warning: exported method ProcStatsSeekReader.Close should have comment or be unexported (golint)
    • cpustat/lib/system_stats.go
    • Line 21: warning: package comment should be of the form "Package cpustat ..." (golint)
    • Line 31: warning: comment on exported var StatsPath should be of the form "StatsPath ..." (golint)
    • Line 34: warning: exported type SystemStats should have comment or be unexported (golint)
    • Line 52: warning: exported function SystemStatsReader should have comment or be unexported (golint)
    • Line 60: warning: exported function SystemStatsReaderFromLines should have comment or be unexported (golint)
    • Line 101: warning: exported function SystemStatsRecord should have comment or be unexported (golint)
    • cpustat/lib/system_stats_seek.go
    • Line 34: warning: exported type SystemStatsSeekReader should have comment or be unexported (golint)
    • Line 39: warning: exported method SystemStatsSeekReader.Initialize should have comment or be unexported (golint)
    • Line 56: warning: exported method SystemStatsSeekReader.ReadStats should have comment or be unexported (golint)
    • Line 80: warning: exported method SystemStatsSeekReader.Close should have comment or be unexported (golint)
    • cpustat/lib/util.go
    • Line 31: warning: comment on exported function SafeSub should be of the form "SafeSub ..." (golint)
    • Line 41: warning: exported function SafeSubFloat should have comment or be unexported (golint)
    • Line 48: warning: exported function ScaledSub should have comment or be unexported (golint)
    • Line 98: warning: comment on exported function ReadFileLines should be of the form "ReadFileLines ..." (golint)
    • Line 110: warning: comment on exported function ReadFloat should be of the form "ReadFloat ..." (golint)
    • Line 120: warning: comment on exported function ReadUInt should be of the form "ReadUInt ..." (golint)
    • Line 129: warning: comment on exported function ReadInt should be of the form "ReadInt ..." (golint)
    • Line 138: warning: comment on exported function StripSpecial should be of the form "StripSpecial ..." (golint)
    • cpustat/lib/cmdline.go
    • Line 65: warning: exported type ProcInfoMap should have comment or be unexported (golint)
    • Line 67: warning: exported method ProcInfoMap.MaybePrune should have comment or be unexported (golint)
    • Line 73: warning: should omit 2nd value from range; this loop is equivalent to `for pid := range ...` (golint)
    • cpustat/lib/histograms.go
    • Line 35: warning: comment on exported type ProcStatsHist should be of the form "ProcStatsHist ..." (with optional leading article) (golint)
    • Line 45: warning: exported type ProcStatsHistMap should have comment or be unexported (golint)
    • Line 47: warning: exported function UpdateProcStatsHist should have comment or be unexported (golint)
    • Line 64: warning: exported function NewProcStatsHist should have comment or be unexported (golint)
    • Line 75: warning: exported type TaskStatsHist should have comment or be unexported (golint)
    • Line 81: warning: exported type TaskStatsHistMap should have comment or be unexported (golint)
    • Line 83: warning: exported function UpdateTaskStatsHist should have comment or be unexported (golint)
    • Line 97: warning: exported function NewTaskStatsHist should have comment or be unexported (golint)
    • Line 105: warning: exported type SystemStatsHist should have comment or be unexported (golint)
    • Line 116: warning: exported function UpdateSysStatsHist should have comment or be unexported (golint)
    • Line 127: warning: exported function NewSysStatsHist should have comment or be unexported (golint)
    • cpustat/lib/netlink.go
    • Line 198: warning: exported function TaskStatsLookupPid should have comment or be unexported (golint)
    • Line 299: warning: exported method NLConn.Close should have comment or be unexported (golint)
    • cpustat/lib/pidlist.go
    • Line 32: warning: exported type Pidlist should have comment or be unexported (golint)
    • Line 34: warning: comment on exported function GetPidList should be of the form "GetPidList ..." (golint)
    • cpustat/cpustat-agent/memdb.go
    • Line 14: warning: exported type MemDB should have comment or be unexported (golint)
    • Line 22: warning: exported method MemDB.Init should have comment or be unexported (golint)
    • Line 37: warning: exported method MemDB.DBCount should have comment or be unexported (golint)
    • Line 44: warning: exported method MemDB.DBStats should have comment or be unexported (golint)
    • Line 61: warning: exported method MemDB.WriteSample should have comment or be unexported (golint)
    • Line 77: warning: exported method MemDB.ReserveSample should have comment or be unexported (golint)
    • Line 83: warning: exported method MemDB.ReleaseSample should have comment or be unexported (golint)
    • Line 96: warning: comment on exported method MemDB.ReadSamples should be of the form "ReadSamples ..." (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign91%

IneffAssign detects ineffectual assignments in Go code.

    • cpustat/cpustat-client/client.go
    • Line 80: warning: ineffectual assignment to err (ineffassign)
    • Line 82: warning: ineffectual assignment to err (ineffassign)
    • Line 84: warning: ineffectual assignment to err (ineffassign)
    • Line 86: warning: ineffectual assignment to err (ineffassign)
    • Line 92: warning: ineffectual assignment to err (ineffassign)
    • Line 93: warning: ineffectual assignment to err (ineffassign)
    • Line 397: warning: ineffectual assignment to err (ineffassign)
    • Line 402: warning: ineffectual assignment to err (ineffassign)
    • Line 408: warning: ineffectual assignment to err (ineffassign)
    • Line 409: warning: ineffectual assignment to err (ineffassign)
    • Line 410: warning: ineffectual assignment to err (ineffassign)

misspell95%

Misspell Finds commonly misspelled English words