Preparing report...

Report for github.com/iwannay/kratos

A+    Excellent!    Found 70 issues across 365 files

Tweet

gofmt97%

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!


gocyclo94%

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.

    • kratos/pkg/net/http/blademaster/tree.go
    • Line 513: warning: cyclomatic complexity 38 of function (*node).findCaseInsensitivePath() is high (> 15) (gocyclo)
    • Line 372: warning: cyclomatic complexity 38 of function (*node).getValue() is high (> 15) (gocyclo)
    • Line 125: warning: cyclomatic complexity 27 of function (*node).addRoute() is high (> 15) (gocyclo)
    • Line 254: warning: cyclomatic complexity 18 of function (*node).insertChild() is high (> 15) (gocyclo)
    • kratos/pkg/cache/redis/scan.go
    • Line 141: warning: cyclomatic complexity 30 of function convertAssign() is high (> 15) (gocyclo)
    • Line 412: warning: cyclomatic complexity 21 of function ScanSlice() is high (> 15) (gocyclo)
    • Line 263: warning: cyclomatic complexity 18 of function compileStructSpec() is high (> 15) (gocyclo)
    • kratos/tool/kratos-gen-mc/main.go
    • Line 255: warning: cyclomatic complexity 40 of function getKeyValueType() is high (> 15) (gocyclo)
    • Line 179: warning: cyclomatic complexity 20 of function processList() is high (> 15) (gocyclo)
    • Line 444: warning: cyclomatic complexity 18 of function getNewTemplate() is high (> 15) (gocyclo)
    • kratos/tool/testgen/gen.go
    • Line 34: warning: cyclomatic complexity 41 of function (*parse).genUTTest() is high (> 15) (gocyclo)
    • Line 337: warning: cyclomatic complexity 22 of function genMonkey() is high (> 15) (gocyclo)

golint91%

Golint is a linter for Go source code.

    • kratos/pkg/net/trace/span.go
    • Line 30: warning: exported method Span.ServiceName should have comment or be unexported (golint)
    • Line 34: warning: exported method Span.OperationName should have comment or be unexported (golint)
    • Line 38: warning: exported method Span.StartTime should have comment or be unexported (golint)
    • Line 42: warning: exported method Span.Duration should have comment or be unexported (golint)
    • Line 46: warning: exported method Span.TraceID should have comment or be unexported (golint)
    • Line 50: warning: exported method Span.Context should have comment or be unexported (golint)
    • Line 54: warning: exported method Span.Tags should have comment or be unexported (golint)
    • Line 58: warning: exported method Span.Logs should have comment or be unexported (golint)
    • Line 62: warning: exported method Span.Fork should have comment or be unexported (golint)
    • Line 72: warning: exported method Span.Follow should have comment or be unexported (golint)
    • Line 76: warning: exported method Span.Finish should have comment or be unexported (golint)
    • Line 89: warning: exported method Span.SetTag should have comment or be unexported (golint)
    • Line 102: warning: comment on exported method Span.SetLog should be of the form "SetLog ..." (golint)
    • kratos/pkg/cache/redis/pipeline.go
    • Line 8: warning: exported type Pipeliner should have comment or be unexported (golint)
    • Line 17: warning: exported var ErrNoReply should have comment or be unexported (golint)
    • Line 25: warning: exported type Replies should have comment or be unexported (golint)
    • Line 34: warning: exported method Replies.Next should have comment or be unexported (golint)
    • Line 38: warning: exported method Replies.Scan should have comment or be unexported (golint)
    • kratos/tool/protobuf/pkg/generator/generator.go
    • Line 23: warning: exported const Version should have comment or be unexported (golint)
    • Line 25: warning: exported var GoModuleImportPath should have comment or be unexported (golint)
    • Line 26: warning: exported var GoModuleDirName should have comment or be unexported (golint)
    • Line 28: warning: exported type Base should have comment or be unexported (golint)
    • Line 75: warning: exported method Base.Setup should have comment or be unexported (golint)
    • Line 141: warning: exported method Base.DeduceDeps should have comment or be unexported (golint)
    • Line 206: warning: exported method Base.GoPackageNameForProtoFile should have comment or be unexported (golint)
    • Line 227: warning: exported method Base.FormattedOutput should have comment or be unexported (golint)
    • Line 253: warning: exported method Base.PrintComments should have comment or be unexported (golint)
    • Line 275: warning: comment on exported method Base.GoTypeName should be of the form "GoTypeName ..." (golint)
    • Line 300: warning: exported method Base.ShouldGenForMethod should have comment or be unexported (golint)
    • Line 312: warning: exported method Base.SubstituteImportPath should have comment or be unexported (golint)
    • kratos/pkg/container/group/group_test.go
    • Line 39: warning: should omit values from range; this loop is equivalent to `for range ...` (golint)
    • Line 55: warning: should omit values from range; this loop is equivalent to `for range ...` (golint)
    • Line 62: warning: should omit values from range; this loop is equivalent to `for range ...` (golint)
    • kratos/pkg/net/trace/jaeger/jaeger.go
    • Line 8: warning: exported type Config should have comment or be unexported (golint)
    • Line 13: warning: exported type JaegerReporter should have comment or be unexported (golint)
    • Line 23: warning: exported method JaegerReporter.WriteSpan should have comment or be unexported (golint)
    • Line 47: warning: exported method JaegerReporter.Close should have comment or be unexported (golint)
    • Line 47: warning: receiver name rpt should be consistent with previous receiver name r for JaegerReporter (golint)
    • kratos/tool/protobuf/pkg/generator/command_line.go
    • Line 8: warning: exported type ParamsBase should have comment or be unexported (golint)
    • Line 15: warning: exported type GeneratorParamsInterface should have comment or be unexported (golint)
    • Line 20: warning: exported type BasicParam should have comment or be unexported (golint)
    • Line 22: warning: exported method BasicParam.GetBase should have comment or be unexported (golint)
    • Line 25: warning: exported method BasicParam.SetParam should have comment or be unexported (golint)
    • Line 29: warning: exported function ParseGeneratorParams should have comment or be unexported (golint)
    • kratos/pkg/database/orm/xorm.go
    • Line 10: warning: a blank import should be only in a main or test package, or have a comment justifying it (golint)
    • Line 18: warning: exported type Client should have comment or be unexported (golint)
    • Line 27: warning: exported type Options should have comment or be unexported (golint)
    • Line 34: warning: exported method Options.Sign should have comment or be unexported (golint)
    • Line 38: warning: exported method Client.Switch should have comment or be unexported (golint)
    • Line 56: warning: exported method Client.GetOpts should have comment or be unexported (golint)
    • Line 64: warning: exported function New should have comment or be unexported (golint)
    • kratos/pkg/net/http/blademaster/cors.go
    • Line 86: warning: exported type SetConfig should have comment or be unexported (golint)
    • Line 87: warning: exported function WithAllowMethods should have comment or be unexported (golint)
    • Line 92: warning: exported function WithAllowHeaders should have comment or be unexported (golint)
    • Line 97: warning: exported function WithAllowCredentials should have comment or be unexported (golint)
    • Line 103: warning: exported function WithMaxAge should have comment or be unexported (golint)
    • kratos/pkg/cache/redis/redis.go
    • Line 44: warning: exported type Redis should have comment or be unexported (golint)
    • Line 49: warning: exported function NewRedis should have comment or be unexported (golint)
    • Line 75: warning: exported method Redis.Pipeline should have comment or be unexported (golint)
    • kratos/tool/protobuf/pkg/tag/tags.go
    • Line 24: warning: exported function GetTagsInComment should have comment or be unexported (golint)
    • Line 36: warning: exported function GetTagValue should have comment or be unexported (golint)
    • Line 46: warning: comment on exported function GetLineTag should be of the form "GetLineTag ..." (golint)
    • kratos/pkg/cache/rdb/redis.go
    • Line 10: warning: exported type MetricsHook should have comment or be unexported (golint)
    • Line 13: warning: exported type CustomOptions should have comment or be unexported (golint)
    • Line 23: warning: comment on exported function NewClusterClient should be of the form "NewClusterClient ..." (golint)
    • kratos/pkg/net/http/blademaster/trace.go
    • Line 140: warning: exported method Client.ReqDuration should have comment or be unexported (golint)
    • Line 144: warning: exported method Client.ConnDuration should have comment or be unexported (golint)
    • Line 148: warning: exported method Client.Duration should have comment or be unexported (golint)
    • kratos/pkg/cache/rdb/hook.go
    • Line 9: warning: exported type TracingHook should have comment or be unexported (golint)
    • Line 13: warning: exported method TracingHook.BeforeProcess should have comment or be unexported (golint)
    • Line 18: warning: exported method TracingHook.AfterProcess should have comment or be unexported (golint)
    • Line 22: warning: exported method TracingHook.BeforeProcessPipeline should have comment or be unexported (golint)
    • Line 26: warning: exported method TracingHook.AfterProcessPipeline should have comment or be unexported (golint)
    • kratos/pkg/database/orm/hook.go
    • Line 16: warning: exported type OtelHook should have comment or be unexported (golint)
    • Line 21: warning: exported function NewOtelHook should have comment or be unexported (golint)
    • Line 31: warning: exported method OtelHook.BeforeProcess should have comment or be unexported (golint)
    • Line 41: warning: exported method OtelHook.AfterProcess should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign98%

IneffAssign detects ineffectual assignments in Go code.


misspell96%

Misspell Finds commonly misspelled English words

    • kratos/pkg/conf/env/env.go
    • Line 31: warning: "avaliable" is a misspelling of "available" (misspell)
    • Line 33: warning: "avaliable" is a misspelling of "available" (misspell)
    • Line 62: warning: "avaliable" is a misspelling of "available" (misspell)
    • Line 63: warning: "avaliable" is a misspelling of "available" (misspell)