Preparing report...

Report for github.com/unit-io/unitdb

A+    Excellent!    Found 51 issues across 126 files

Tweet

gofmt96%

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!


gocyclo91%

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.

    • unitdb/db.go
    • Line 50: warning: cyclomatic complexity 23 of function Open() is high (> 15) (gocyclo)
    • Line 222: warning: cyclomatic complexity 22 of function (*DB).Get() is high (> 15) (gocyclo)
    • unitdb/recovery.go
    • Line 45: warning: cyclomatic complexity 23 of function (*_SyncHandle).startRecovery() is high (> 15) (gocyclo)
    • unitdb/memdb/db_test.go
    • Line 94: warning: cyclomatic complexity 17 of function TestRecovery() is high (> 15) (gocyclo)
    • Line 24: warning: cyclomatic complexity 16 of function TestSimple() is high (> 15) (gocyclo)

golint69%

Golint is a linter for Go source code.

    • unitdb/server/internal/pkg/uid/clientid.go
    • Line 32: warning: exported const AllowNone should have comment (or a comment on this block) or be unexported (golint)
    • Line 44: warning: comment on exported method ID.Epoch should be of the form "Epoch ..." (golint)
    • Line 49: warning: comment on exported method ID.SetEpoch should be of the form "SetEpoch ..." (golint)
    • Line 92: warning: exported method ID.Encode should have comment or be unexported (golint)
    • Line 110: warning: exported function Decode should have comment or be unexported (golint)
    • unitdb/server/internal/net/hdl_grpc.go
    • Line 32: warning: exported type GrpcServer should have comment or be unexported (golint)
    • Line 34: warning: exported function NewGrpcServer should have comment or be unexported (golint)
    • Line 45: warning: exported function StreamConn should have comment or be unexported (golint)
    • Line 70: warning: exported method GrpcServer.Serve should have comment or be unexported (golint)
    • unitdb/server/internal/monitor.go
    • Line 29: warning: exported type Meter should have comment or be unexported (golint)
    • Line 40: warning: exported function NewMeter should have comment or be unexported (golint)
    • Line 64: warning: exported method Meter.UnregisterAll should have comment or be unexported (golint)
    • Line 68: warning: comment on exported type Varz should be of the form "Varz ..." (with optional leading article) (golint)
    • Line 148: warning: receiver name m should be consistent with previous receiver name s for _Service (golint)
    • unitdb/server/internal/pkg/uid/uid.go
    • Line 27: warning: exported const Offset should have comment (or a comment on this block) or be unexported (golint)
    • Line 31: warning: comment on exported var Next should be of the form "Next ..." (golint)
    • Line 38: warning: exported function NewApoch should have comment or be unexported (golint)
    • Line 43: warning: exported function NewUnique should have comment or be unexported (golint)
    • unitdb/server/internal/pkg/metrics/metrics.go
    • Line 55: warning: comment on exported type StandardMetrics should be of the form "StandardMetrics ..." (with optional leading article) (golint)
    • Line 62: warning: comment on exported function NewMetrics should be of the form "NewMetrics ..." (golint)
    • Line 67: warning: comment on exported method StandardMetrics.GetOrRegister should be of the form "GetOrRegister ..." (golint)
    • Line 101: warning: comment on exported method StandardMetrics.UnregisterAll should be of the form "UnregisterAll ..." (golint)
    • Line 105: warning: should omit 2nd value from range; this loop is equivalent to `for name := range ...` (golint)
    • unitdb/server/internal/pkg/metrics/timeseries.go
    • Line 24: warning: comment on exported type TimeSeries should be of the form "TimeSeries ..." (with optional leading article) (golint)
    • Line 46: warning: comment on exported function GetOrRegisterTimeSeries should be of the form "GetOrRegisterTimeSeries ..." (golint)
    • Line 54: warning: comment on exported function NewTimeSeries should be of the form "NewTimeSeries ..." (golint)
    • Line 239: warning: comment on exported method TimeSeriesSnapshot.Range should be of the form "Range ..." (golint)
    • unitdb/server/internal/net/hdl_tcp.go
    • Line 27: warning: exported type TcpServer should have comment or be unexported (golint)
    • Line 29: warning: exported function NewTcpServer should have comment or be unexported (golint)
    • Line 40: warning: exported method TcpServer.Serve should have comment or be unexported (golint)
    • unitdb/server/internal/net/line_protocol.go
    • Line 24: warning: comment on exported type DeliveryMode should be of the form "DeliveryMode ..." (with optional leading article) (golint)
    • Line 34: warning: comment on exported const CONNECT should be of the form "CONNECT ..." (golint)
    • Line 36: warning: exported const PUBLISH should have comment (or a comment on this block) or be unexported (golint)
    • Line 44: warning: comment on exported const NONE should be of the form "NONE ..." (golint)
    • Line 46: warning: exported const ACKNOWLEDGE should have comment (or a comment on this block) or be unexported (golint)
    • Line 53: warning: exported const EXPRESS should have comment (or a comment on this block) or be unexported (golint)
    • Line 58: warning: exported method MessageType.Value should have comment or be unexported (golint)
    • Line 62: warning: exported method FlowControl.Value should have comment or be unexported (golint)
    • Line 78: warning: comment on exported type FixedHeader should be of the form "FixedHeader ..." (with optional leading article) (golint)
    • Line 180: warning: exported type ProtoAdapter should have comment or be unexported (golint)
    • Line 185: warning: exported function Read should have comment or be unexported (golint)
    • Line 189: warning: exported function Encode should have comment or be unexported (golint)
    • unitdb/server/internal/message/sub.go
    • Line 24: warning: exported const CONNECT should have comment (or a comment on this block) or be unexported (golint)
    • Line 42: warning: exported type TopicAnyCount should have comment or be unexported (golint)
    • Line 82: warning: exported type Stat should have comment or be unexported (golint)
    • Line 129: warning: comment on exported method Stats.Exist should be of the form "Exist ..." (golint)
    • unitdb/server/common/encode.go
    • Line 24: warning: exported const MaxMessageSize should have comment (or a comment on this block) or be unexported (golint)
    • Line 36: warning: comment on exported type Decoder should be of the form "Decoder ..." (with optional leading article) (golint)
    • Line 63: warning: comment on exported function Decode should be of the form "Decode ..." (golint)
    • unitdb/server/internal/pkg/stats/stats.go
    • Line 17: warning: package comment should be of the form "Package stats ..." (golint)
    • Line 40: warning: comment on exported type Stats should be of the form "Stats ..." (with optional leading article) (golint)
    • Line 233: warning: exported method Stats.Unregister should have comment or be unexported (golint)
    • unitdb/server/internal/net/hdl_grpc_web.go
    • Line 30: warning: exported type HttpServer should have comment or be unexported (golint)
    • Line 32: warning: exported function NewHttpServer should have comment or be unexported (golint)
    • Line 81: warning: exported method HttpServer.HandleFunc should have comment or be unexported (golint)
    • Line 99: warning: exported method HttpServer.Serve should have comment or be unexported (golint)
    • unitdb/server/internal/net/server.go
    • Line 31: warning: exported const MaxMessageSize should have comment (or a comment on this block) or be unexported (golint)
    • Line 41: warning: exported const UTP should have comment (or a comment on this block) or be unexported (golint)
    • Line 92: warning: exported type Server should have comment or be unexported (golint)
    • unitdb/server/internal/message/messageids.go
    • Line 26: warning: exported type MessageIds should have comment or be unexported (golint)
    • Line 33: warning: exported function NewMessageIds should have comment or be unexported (golint)
    • Line 40: warning: exported method MessageIds.Reset should have comment or be unexported (golint)
    • Line 46: warning: exported method MessageIds.ResumeID should have comment or be unexported (golint)
    • Line 52: warning: exported method MessageIds.FreeID should have comment or be unexported (golint)
    • Line 58: warning: exported method MessageIds.NextID should have comment or be unexported (golint)
    • Line 69: warning: exported method MessageIds.GetType should have comment or be unexported (golint)
    • unitdb/server/internal/net/listener/listener.go
    • Line 125: warning: exported type ErrorHandler should have comment or be unexported (golint)
    • Line 129: warning: exported type ErrProtoNotMatched should have comment or be unexported (golint)
    • Line 157: warning: exported type Listener should have comment or be unexported (golint)
    • Line 166: warning: exported function New should have comment or be unexported (golint)
    • Line 186: warning: exported method Listener.SetReadTimeout should have comment or be unexported (golint)
    • Line 190: warning: exported method Listener.Addr should have comment or be unexported (golint)
    • Line 194: warning: exported method Listener.Accept should have comment or be unexported (golint)
    • Line 198: warning: exported method Listener.ServeCallback should have comment or be unexported (golint)
    • Line 203: warning: exported method Listener.Proto should have comment or be unexported (golint)
    • Line 275: warning: exported method Listener.HandleError should have comment or be unexported (golint)
    • unitdb/server/internal/pkg/metrics/sample.go
    • Line 27: warning: comment on exported type Sample should be of the form "Sample ..." (with optional leading article) (golint)
    • Line 58: warning: exported type Config should have comment or be unexported (golint)
    • Line 71: warning: comment on exported function NewSample should be of the form "NewSample ..." (golint)
    • Line 165: warning: exported function NewSampleSnapshot should have comment or be unexported (golint)
    • Line 216: warning: comment on exported method SampleSnapshot.Range should be of the form "Range ..." (golint)
    • Line 234: warning: receiver name ts should be consistent with previous receiver name p for timeSlice (golint)
    • Line 243: warning: receiver name ts should be consistent with previous receiver name p for timeSlice (golint)
    • Line 253: warning: receiver name ts should be consistent with previous receiver name p for timeSlice (golint)
    • Line 261: warning: receiver name ts should be consistent with previous receiver name p for timeSlice (golint)
    • Line 265: warning: receiver name ts should be consistent with previous receiver name p for timeSlice (golint)
    • Line 278: warning: receiver name ts should be consistent with previous receiver name p for timeSlice (golint)
    • Line 295: warning: receiver name ts should be consistent with previous receiver name p for timeSlice (golint)
    • Line 312: warning: receiver name ts should be consistent with previous receiver name p for timeSlice (golint)
    • Line 316: warning: receiver name ts should be consistent with previous receiver name p for timeSlice (golint)
    • Line 320: warning: receiver name ts should be consistent with previous receiver name p for timeSlice (golint)
    • unitdb/file.go
    • Line 268: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • unitdb/server/internal/config/config.go
    • Line 26: warning: exported const MaxMessageSize should have comment (or a comment on this block) or be unexported (golint)
    • Line 81: warning: exported method Config.Encryption should have comment or be unexported (golint)
    • Line 96: warning: exported method Config.Store should have comment or be unexported (golint)
    • unitdb/server/internal/pkg/crypto/mac.go
    • Line 28: warning: exported const EpochSize should have comment (or a comment on this block) or be unexported (golint)
    • Line 64: warning: exported function SignatureToUint32 should have comment or be unexported (golint)
    • Line 68: warning: exported function Signature should have comment or be unexported (golint)
    • unitdb/server/internal/store/store.go
    • Line 132: warning: comment on exported var Subscription should be of the form "Subscription ..." (golint)
    • Line 135: warning: exported method SubscriptionStore.Put should have comment or be unexported (golint)
    • Line 139: warning: exported method SubscriptionStore.Get should have comment or be unexported (golint)
    • Line 151: warning: exported method SubscriptionStore.NewID should have comment or be unexported (golint)
    • Line 155: warning: exported method SubscriptionStore.Delete should have comment or be unexported (golint)
    • Line 165: warning: exported method MessageStore.Put should have comment or be unexported (golint)
    • Line 169: warning: exported method MessageStore.Get should have comment or be unexported (golint)
    • Line 188: warning: exported method SessionStore.Put should have comment or be unexported (golint)
    • Line 192: warning: exported method SessionStore.Get should have comment or be unexported (golint)
    • unitdb/server/internal/cluster.go
    • Line 334: warning: comment on exported method Cluster.Proxy should be of the form "Proxy ..." (golint)
    • Line 445: warning: comment on exported function ClusterInit should be of the form "ClusterInit ..." (golint)
    • unitdb/server/internal/types/types.go
    • Line 34: warning: comment on exported method Error.ErrrorCode should be of the form "ErrrorCode ..." (golint)
    • Line 55: warning: exported type KeyGenRequest should have comment or be unexported (golint)
    • Line 60: warning: exported method KeyGenRequest.Access should have comment or be unexported (golint)
    • Line 75: warning: exported type KeyGenResponse should have comment or be unexported (golint)
    • Line 81: warning: exported type ClientIdResponse should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign96%

IneffAssign detects ineffectual assignments in Go code.


misspell96%

Misspell Finds commonly misspelled English words