Preparing report...

Report for github.com/DrmagicE/gmqtt

A+    Excellent!    Found 65 issues across 149 files

Tweet

gofmt100%

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

No problems detected. Good job!


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!


gocyclo96%

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.


golint59%

Golint is a linter for Go source code.

    • gmqtt/pkg/codes/codes.go
    • Line 8: warning: exported var ErrMalformed should have comment or be unexported (golint)
    • Line 22: warning: comment on exported type Code should be of the form "Code ..." (with optional leading article) (golint)
    • Line 95: warning: exported function NewError should have comment or be unexported (golint)
    • gmqtt/cmd/gmqctl/version.go
    • Line 3: warning: comment on exported var GitCommit should be of the form "GitCommit ..." (golint)
    • Line 6: warning: comment on exported const Version should be of the form "Version ..." (golint)
    • gmqtt/server/hook.go
    • Line 12: warning: exported type Hooks should have comment or be unexported (golint)
    • Line 54: warning: exported type OnWillPublishWrapper should have comment or be unexported (golint)
    • Line 60: warning: exported type OnWillPublishedWrapper should have comment or be unexported (golint)
    • Line 66: warning: exported type OnAcceptWrapper should have comment or be unexported (golint)
    • Line 71: warning: exported type OnStopWrapper should have comment or be unexported (golint)
    • Line 120: warning: exported type OnSubscribeWrapper should have comment or be unexported (golint)
    • Line 125: warning: exported type OnSubscribedWrapper should have comment or be unexported (golint)
    • Line 130: warning: exported type OnUnsubscribedWrapper should have comment or be unexported (golint)
    • Line 162: warning: exported type OnUnsubscribeWrapper should have comment or be unexported (golint)
    • Line 196: warning: exported type OnMsgArrivedWrapper should have comment or be unexported (golint)
    • Line 201: warning: exported type OnClosedWrapper should have comment or be unexported (golint)
    • Line 203: warning: exported type AuthOptions should have comment or be unexported (golint)
    • Line 232: warning: exported type OnBasicAuthWrapper should have comment or be unexported (golint)
    • Line 237: warning: exported type EnhancedAuthResponse should have comment or be unexported (golint)
    • Line 243: warning: exported type OnEnhancedAuthWrapper should have comment or be unexported (golint)
    • Line 245: warning: exported type AuthRequest should have comment or be unexported (golint)
    • Line 250: warning: comment on exported type AuthResponse should be of the form "AuthResponse ..." (with optional leading article) (golint)
    • Line 258: warning: exported type OnAuth should have comment or be unexported (golint)
    • Line 260: warning: exported type OnReAuthWrapper should have comment or be unexported (golint)
    • Line 262: warning: exported type OnReAuth should have comment or be unexported (golint)
    • Line 264: warning: exported type OnAuthWrapper should have comment or be unexported (golint)
    • Line 269: warning: exported type OnConnectedWrapper should have comment or be unexported (golint)
    • Line 274: warning: exported type OnSessionCreatedWrapper should have comment or be unexported (golint)
    • Line 279: warning: exported type OnSessionResumedWrapper should have comment or be unexported (golint)
    • Line 281: warning: exported type SessionTerminatedReason should have comment or be unexported (golint)
    • Line 284: warning: exported const NormalTermination should have comment (or a comment on this block) or be unexported (golint)
    • Line 292: warning: exported type OnSessionTerminatedWrapper should have comment or be unexported (golint)
    • Line 297: warning: exported type OnDeliveredWrapper should have comment or be unexported (golint)
    • Line 304: warning: exported type OnMsgDroppedWrapper should have comment or be unexported (golint)
    • gmqtt/pkg/packets/properties.go
    • Line 14: warning: exported const PropPayloadFormat should have comment (or a comment on this block) or be unexported (golint)
    • Line 47: warning: exported type UserProperty should have comment or be unexported (golint)
    • Line 194: warning: exported method Properties.PackWillProperties should have comment or be unexported (golint)
    • Line 275: warning: exported method Properties.UnpackWillProperties should have comment or be unexported (golint)
    • Line 492: warning: exported function ValidateCode should have comment or be unexported (golint)
    • gmqtt/plugin/admin/admin.go
    • Line 12: warning: exported const Name should have comment or be unexported (golint)
    • Line 18: warning: exported function New should have comment or be unexported (golint)
    • Line 48: warning: exported method Admin.Load should have comment or be unexported (golint)
    • Line 66: warning: exported method Admin.Unload should have comment or be unexported (golint)
    • Line 70: warning: exported method Admin.Name should have comment or be unexported (golint)
    • gmqtt/plugin/auth/hooks.go
    • Line 13: warning: exported method Auth.HookWrapper should have comment or be unexported (golint)
    • Line 19: warning: exported method Auth.OnBasicAuthWrapper should have comment or be unexported (golint)
    • gmqtt/pkg/packets/packets.go
    • Line 19: warning: comment on exported type Version should be of the form "Version ..." (with optional leading article) (golint)
    • Line 22: warning: exported type QoS should have comment or be unexported (golint)
    • Line 25: warning: exported const Version311 should have comment (or a comment on this block) or be unexported (golint)
    • Line 27: warning: comment on exported const MaximumSize should be of the form "MaximumSize ..." (golint)
    • Line 76: warning: exported type PayloadFormat should have comment or be unexported (golint)
    • Line 79: warning: exported const PayloadFormatBytes should have comment (or a comment on this block) or be unexported (golint)
    • Line 160: warning: exported method Reader.SetVersion should have comment or be unexported (golint)
    • gmqtt/cmd/gmqctl/command/gen-plugin/tmpl.go
    • Line 1: warning: don't use an underscore in package name (golint)
    • Line 14: warning: exported const MainTemplate should have comment or be unexported (golint)
    • Line 56: warning: exported const HookTemplate should have comment or be unexported (golint)
    • Line 81: warning: exported const ConfigTemplate should have comment or be unexported (golint)
    • gmqtt/config/topic_alias.go
    • Line 3: warning: exported type TopicAliasType should have comment or be unexported (golint)
    • Line 6: warning: exported const TopicAliasMgrTypeFIFO should have comment (or a comment on this block) or be unexported (golint)
    • gmqtt/persistence/queue/mem/mem.go
    • Line 17: warning: exported type Options should have comment or be unexported (golint)
    • Line 24: warning: exported type Queue should have comment or be unexported (golint)
    • Line 42: warning: exported function New should have comment or be unexported (golint)
    • Line 54: warning: exported method Queue.Close should have comment or be unexported (golint)
    • Line 62: warning: exported method Queue.Init should have comment or be unexported (golint)
    • Line 78: warning: exported method Queue.Clean should have comment or be unexported (golint)
    • Line 82: warning: exported method Queue.Add should have comment or be unexported (golint)
    • Line 164: warning: exported method Queue.Replace should have comment or be unexported (golint)
    • Line 238: warning: exported method Queue.ReadInflight should have comment or be unexported (golint)
    • Line 264: warning: exported method Queue.Remove should have comment or be unexported (golint)
    • gmqtt/server/persistence.go
    • Line 11: warning: exported type NewPersistence should have comment or be unexported (golint)
    • Line 13: warning: exported type Persistence should have comment or be unexported (golint)
    • gmqtt/persistence/queue/redis/redis.go
    • Line 27: warning: exported type Options should have comment or be unexported (golint)
    • Line 35: warning: exported type Queue should have comment or be unexported (golint)
    • Line 57: warning: exported function New should have comment or be unexported (golint)
    • Line 84: warning: exported method Queue.Close should have comment or be unexported (golint)
    • Line 106: warning: exported method Queue.Init should have comment or be unexported (golint)
    • Line 133: warning: exported method Queue.Clean should have comment or be unexported (golint)
    • Line 140: warning: exported method Queue.Add should have comment or be unexported (golint)
    • Line 166: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 250: warning: exported method Queue.Replace should have comment or be unexported (golint)
    • Line 367: warning: exported method Queue.ReadInflight should have comment or be unexported (golint)
    • Line 409: warning: exported method Queue.Remove should have comment or be unexported (golint)
    • gmqtt/plugin/auth/auth.go
    • Line 26: warning: exported const Name should have comment or be unexported (golint)
    • Line 33: warning: exported function New should have comment or be unexported (golint)
    • Line 129: warning: exported method Auth.Load should have comment or be unexported (golint)
    • Line 176: warning: exported method Auth.Unload should have comment or be unexported (golint)
    • Line 180: warning: exported method Auth.Name should have comment or be unexported (golint)
    • gmqtt/pkg/packets/auth.go
    • Line 11: warning: exported type Auth should have comment or be unexported (golint)
    • Line 21: warning: exported method Auth.Pack should have comment or be unexported (golint)
    • Line 37: warning: exported method Auth.Unpack should have comment or be unexported (golint)
    • Line 59: warning: exported function NewAuthPacket should have comment or be unexported (golint)
    • gmqtt/server/stats.go
    • Line 332: warning: exported type DroppedTotal should have comment or be unexported (golint)
    • Line 340: warning: exported type MessageQosStats should have comment or be unexported (golint)
    • Line 346: warning: exported method MessageQosStats.GetDroppedTotal should have comment or be unexported (golint)
    • Line 359: warning: exported method MessageStats.GetDroppedTotal should have comment or be unexported (golint)
    • Line 460: warning: exported method ClientStats.GetDroppedTotal should have comment or be unexported (golint)
    • Line 480: warning: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) (golint)
    • gmqtt/persistence/queue/elem.go
    • Line 14: warning: exported type MessageWithID should have comment or be unexported (golint)
    • Line 19: warning: exported type Publish should have comment or be unexported (golint)
    • Line 23: warning: exported method Publish.ID should have comment or be unexported (golint)
    • Line 26: warning: exported method Publish.SetID should have comment or be unexported (golint)
    • Line 30: warning: exported type Pubrel should have comment or be unexported (golint)
    • Line 34: warning: exported method Pubrel.ID should have comment or be unexported (golint)
    • Line 37: warning: exported method Pubrel.SetID should have comment or be unexported (golint)
    • Line 56: warning: exported method Publish.Decode should have comment or be unexported (golint)
    • Line 70: warning: exported method Pubrel.Decode should have comment or be unexported (golint)
    • Line 95: warning: exported method Elem.Decode should have comment or be unexported (golint)
    • gmqtt/server/options.go
    • Line 11: warning: exported type Options should have comment or be unexported (golint)
    • Line 48: warning: exported function WithLogger should have comment or be unexported (golint)
    • gmqtt/cmd/gmqttd/version.go
    • Line 3: warning: comment on exported var GitCommit should be of the form "GitCommit ..." (golint)
    • Line 6: warning: comment on exported const Version should be of the form "Version ..." (golint)
    • gmqtt/plugin/admin/hooks.go
    • Line 10: warning: exported method Admin.HookWrapper should have comment or be unexported (golint)
    • Line 21: warning: exported method Admin.OnSessionCreatedWrapper should have comment or be unexported (golint)
    • Line 28: warning: exported method Admin.OnSessionResumedWrapper should have comment or be unexported (golint)
    • Line 35: warning: exported method Admin.OnClosedWrapper should have comment or be unexported (golint)
    • Line 42: warning: exported method Admin.OnSessionTerminatedWrapper should have comment or be unexported (golint)
    • Line 49: warning: exported method Admin.OnSubscribedWrapper should have comment or be unexported (golint)
    • Line 56: warning: exported method Admin.OnUnsubscribedWrapper should have comment or be unexported (golint)
    • gmqtt/persistence/unack/redis/redis.go
    • Line 16: warning: exported type Store should have comment or be unexported (golint)
    • Line 22: warning: exported type Options should have comment or be unexported (golint)
    • Line 27: warning: exported function New should have comment or be unexported (golint)
    • Line 38: warning: exported method Store.Init should have comment or be unexported (golint)
    • Line 51: warning: exported method Store.Set should have comment or be unexported (golint)
    • Line 66: warning: exported method Store.Remove should have comment or be unexported (golint)
    • gmqtt/plugin/prometheus/prometheus.go
    • Line 20: warning: exported const Name should have comment (or a comment on this block) or be unexported (golint)
    • Line 29: warning: exported function New should have comment or be unexported (golint)
    • Line 49: warning: exported method Prometheus.Load should have comment or be unexported (golint)
    • Line 66: warning: exported method Prometheus.Unload should have comment or be unexported (golint)
    • Line 70: warning: exported method Prometheus.Name should have comment or be unexported (golint)
    • Line 74: warning: exported method Prometheus.Describe should have comment or be unexported (golint)
    • Line 78: warning: exported method Prometheus.Collect should have comment or be unexported (golint)
    • gmqtt/server/server.go
    • Line 48: warning: exported function RegisterPersistenceFactory should have comment or be unexported (golint)
    • Line 55: warning: exported function RegisterTopicAliasMgrFactory should have comment or be unexported (golint)
    • Line 62: warning: exported function RegisterPlugin should have comment or be unexported (golint)
    • Line 247: warning: exported type DeliveryMode should have comment or be unexported (golint)
    • Line 250: warning: exported const Overlap should have comment (or a comment on this block) or be unexported (golint)
    • gmqtt/config/api.go
    • Line 34: warning: exported var DefaultAPI should have comment or be unexported (golint)
    • Line 59: warning: exported method API.Validate should have comment or be unexported (golint)
    • gmqtt/config/mqtt.go
    • Line 11: warning: exported const Overlap should have comment (or a comment on this block) or be unexported (golint)
    • Line 16: warning: comment on exported var DefaultMQTTConfig should be of the form "DefaultMQTTConfig ..." (golint)
    • Line 39: warning: exported type MQTT should have comment or be unexported (golint)
    • Line 60: warning: exported method MQTT.Validate should have comment or be unexported (golint)
    • gmqtt/config/persistence.go
    • Line 10: warning: exported type PersistenceType should have comment or be unexported (golint)
    • Line 13: warning: exported const PersistenceTypeMemory should have comment (or a comment on this block) or be unexported (golint)
    • Line 69: warning: exported method Persistence.Validate should have comment or be unexported (golint)
    • gmqtt/persistence/session/redis/store.go
    • Line 21: warning: exported type Store should have comment or be unexported (golint)
    • Line 26: warning: exported function New should have comment or be unexported (golint)
    • Line 36: warning: exported method Store.Set should have comment or be unexported (golint)
    • Line 53: warning: exported method Store.Remove should have comment or be unexported (golint)
    • Line 62: warning: exported method Store.Get should have comment or be unexported (golint)
    • Line 90: warning: exported method Store.SetSessionExpiry should have comment or be unexported (golint)
    • Line 101: warning: exported method Store.Iterate should have comment or be unexported (golint)
    • gmqtt/plugin/federation/federation.go
    • Line 36: warning: exported const Name should have comment or be unexported (golint)
    • Line 89: warning: exported function New should have comment or be unexported (golint)
    • Line 123: warning: exported type Federation should have comment or be unexported (golint)
    • Line 432: warning: exported method Federation.EventStream should have comment or be unexported (golint)
    • Line 490: warning: exported method Federation.Load should have comment or be unexported (golint)
    • Line 532: warning: exported method Federation.Unload should have comment or be unexported (golint)
    • Line 540: warning: exported method Federation.Name should have comment or be unexported (golint)
    • gmqtt/persistence/subscription/subscription.go
    • Line 17: warning: comment on exported const TypeShared should be of the form "TypeShared ..." (golint)
    • Line 21: warning: exported const TypeAll should have comment (or a comment on this block) or be unexported (golint)
    • Line 25: warning: exported var ErrClientNotExists should have comment or be unexported (golint)
    • Line 32: warning: exported const MatchName should have comment (or a comment on this block) or be unexported (golint)
    • Line 75: warning: comment on exported type IterationOptions should be of the form "IterationOptions ..." (with optional leading article) (golint)
    • gmqtt/persistence/session/mem/store.go
    • Line 12: warning: exported function New should have comment or be unexported (golint)
    • Line 19: warning: exported type Store should have comment or be unexported (golint)
    • Line 24: warning: exported method Store.Set should have comment or be unexported (golint)
    • Line 31: warning: exported method Store.Remove should have comment or be unexported (golint)
    • Line 38: warning: exported method Store.Get should have comment or be unexported (golint)
    • Line 44: warning: exported method Store.GetAll should have comment or be unexported (golint)
    • Line 48: warning: exported method Store.SetSessionExpiry should have comment or be unexported (golint)
    • Line 58: warning: exported method Store.Iterate should have comment or be unexported (golint)
    • gmqtt/plugin/auth/config.go
    • Line 11: warning: exported const Plain should have comment (or a comment on this block) or be unexported (golint)
    • Line 17: warning: exported var ValidateHashType should have comment or be unexported (golint)
    • Line 30: warning: comment on exported method Config.Validate should be of the form "Validate ..." (golint)
    • Line 49: warning: exported method Config.UnmarshalYAML should have comment or be unexported (golint)
    • gmqtt/config/config.go
    • Line 59: warning: exported var DefaultListeners should have comment or be unexported (golint)
    • Line 83: warning: exported method LogConfig.Validate should have comment or be unexported (golint)
    • Line 125: warning: exported type GRPC should have comment or be unexported (golint)
    • Line 129: warning: exported type TLSOptions should have comment or be unexported (golint)
    • Line 140: warning: exported type ListenerConfig should have comment or be unexported (golint)
    • Line 146: warning: exported type WebsocketOptions should have comment or be unexported (golint)
    • Line 150: warning: exported method Config.UnmarshalYAML should have comment or be unexported (golint)
    • Line 176: warning: exported method Config.Validate should have comment or be unexported (golint)
    • Line 202: warning: exported function ParseConfig should have comment or be unexported (golint)
    • Line 223: warning: exported method Config.GetLogger should have comment or be unexported (golint)
    • gmqtt/plugin/federation/hooks.go
    • Line 12: warning: exported method Federation.HookWrapper should have comment or be unexported (golint)
    • Line 22: warning: exported method Federation.OnSubscribedWrapper should have comment or be unexported (golint)
    • Line 46: warning: exported method Federation.OnUnsubscribedWrapper should have comment or be unexported (golint)
    • Line 178: warning: exported method Federation.OnMsgArrivedWrapper should have comment or be unexported (golint)
    • Line 197: warning: exported method Federation.OnSessionTerminatedWrapper should have comment or be unexported (golint)
    • Line 219: warning: exported method Federation.OnWillPublishWrapper should have comment or be unexported (golint)
    • gmqtt/persistence/unack/mem/mem.go
    • Line 10: warning: exported type Store should have comment or be unexported (golint)
    • Line 15: warning: exported type Options should have comment or be unexported (golint)
    • Line 19: warning: exported function New should have comment or be unexported (golint)
    • Line 26: warning: exported method Store.Init should have comment or be unexported (golint)
    • Line 33: warning: exported method Store.Set should have comment or be unexported (golint)
    • Line 41: warning: exported method Store.Remove should have comment or be unexported (golint)
    • gmqtt/persistence/subscription/mem/trie_db.go
    • Line 33: warning: exported method TrieDB.Init should have comment or be unexported (golint)
    • Line 37: warning: exported method TrieDB.Close should have comment or be unexported (golint)
    • Line 218: warning: exported method TrieDB.Iterate should have comment or be unexported (golint)
    • Line 224: warning: comment on exported method TrieDB.GetStatusLocked should be of the form "GetStatusLocked ..." (golint)
    • Line 240: warning: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) (golint)
    • Line 245: warning: exported method TrieDB.GetClientStats should have comment or be unexported (golint)
    • Line 304: warning: comment on exported method TrieDB.Subscribe should be of the form "Subscribe ..." (golint)
    • gmqtt/persistence/encoding/binary.go
    • Line 10: warning: exported function WriteUint16 should have comment or be unexported (golint)
    • Line 15: warning: exported function WriteBool should have comment or be unexported (golint)
    • Line 23: warning: exported function ReadBool should have comment or be unexported (golint)
    • Line 34: warning: exported function WriteString should have comment or be unexported (golint)
    • Line 38: warning: exported function ReadString should have comment or be unexported (golint)
    • Line 54: warning: exported function WriteUint32 should have comment or be unexported (golint)
    • Line 61: warning: exported function ReadUint16 should have comment or be unexported (golint)
    • Line 68: warning: exported function ReadUint32 should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign95%

IneffAssign detects ineffectual assignments in Go code.


misspell99%

Misspell Finds commonly misspelled English words