Preparing report...

Report for github.com/libp2p/go-libp2p-pubsub

A    Great!    Found 28 issues across 43 files

Tweet

gofmt88%

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!


golint48%

Golint is a linter for Go source code.

    • go-libp2p-pubsub/gossipsub.go
    • Line 23: warning: don't use underscores in Go names; const GossipSubID_v10 should be GossipSubIDV10 (golint)
    • Line 28: warning: don't use underscores in Go names; const GossipSubID_v11 should be GossipSubIDV11 (golint)
    • Line 464: warning: exported method GossipSubRouter.Protocols should have comment or be unexported (golint)
    • Line 468: warning: exported method GossipSubRouter.Attach should have comment or be unexported (golint)
    • Line 505: warning: exported method GossipSubRouter.AddPeer should have comment or be unexported (golint)
    • Line 534: warning: exported method GossipSubRouter.RemovePeer should have comment or be unexported (golint)
    • Line 549: warning: exported method GossipSubRouter.EnoughPeers should have comment or be unexported (golint)
    • Line 578: warning: exported method GossipSubRouter.AcceptFrom should have comment or be unexported (golint)
    • Line 591: warning: exported method GossipSubRouter.HandleRPC should have comment or be unexported (golint)
    • Line 939: warning: exported method GossipSubRouter.Publish should have comment or be unexported (golint)
    • Line 1011: warning: exported method GossipSubRouter.Join should have comment or be unexported (golint)
    • Line 1062: warning: exported method GossipSubRouter.Leave should have comment or be unexported (golint)
    • go-libp2p-pubsub/gossipsub_feat.go
    • Line 17: warning: comment on exported const GossipSubFeatureMesh should be of the form "GossipSubFeatureMesh ..." (golint)
    • Line 19: warning: comment on exported const GossipSubFeaturePX should be of the form "GossipSubFeaturePX ..." (golint)
    • go-libp2p-pubsub/score_params.go
    • Line 12: warning: exported type PeerScoreThresholds should have comment or be unexported (golint)
    • Line 53: warning: exported type PeerScoreParams should have comment or be unexported (golint)
    • Line 98: warning: exported type TopicScoreParams should have comment or be unexported (golint)
    • Line 271: warning: exported const DefaultDecayInterval should have comment (or a comment on this block) or be unexported (golint)
    • Line 281: warning: comment on exported function ScoreParameterDecayWithBase should be of the form "ScoreParameterDecayWithBase ..." (golint)
    • go-libp2p-pubsub/trace_test.go
    • Line 55: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 159: warning: receiver name ts should be consistent with previous receiver name t for traceStats (golint)
    • go-libp2p-pubsub/floodsub.go
    • Line 12: warning: exported const FloodSubID should have comment (or a comment on this block) or be unexported (golint)
    • Line 29: warning: exported type FloodSubRouter should have comment or be unexported (golint)
    • Line 35: warning: exported method FloodSubRouter.Protocols should have comment or be unexported (golint)
    • Line 39: warning: exported method FloodSubRouter.Attach should have comment or be unexported (golint)
    • Line 44: warning: exported method FloodSubRouter.AddPeer should have comment or be unexported (golint)
    • Line 48: warning: exported method FloodSubRouter.RemovePeer should have comment or be unexported (golint)
    • Line 52: warning: exported method FloodSubRouter.EnoughPeers should have comment or be unexported (golint)
    • Line 70: warning: exported method FloodSubRouter.AcceptFrom should have comment or be unexported (golint)
    • Line 74: warning: exported method FloodSubRouter.HandleRPC should have comment or be unexported (golint)
    • Line 76: warning: exported method FloodSubRouter.Publish should have comment or be unexported (golint)
    • Line 102: warning: exported method FloodSubRouter.Join should have comment or be unexported (golint)
    • Line 106: warning: exported method FloodSubRouter.Leave should have comment or be unexported (golint)
    • go-libp2p-pubsub/mcache.go
    • Line 38: warning: exported type MessageCache should have comment or be unexported (golint)
    • Line 46: warning: exported method MessageCache.SetMsgIdFn should have comment or be unexported (golint)
    • Line 50: warning: exported type CacheEntry should have comment or be unexported (golint)
    • Line 55: warning: exported method MessageCache.Put should have comment or be unexported (golint)
    • Line 61: warning: exported method MessageCache.Get should have comment or be unexported (golint)
    • Line 66: warning: exported method MessageCache.GetForPeer should have comment or be unexported (golint)
    • Line 82: warning: exported method MessageCache.GetGossipIDs should have comment or be unexported (golint)
    • Line 94: warning: exported method MessageCache.Shift should have comment or be unexported (golint)
    • go-libp2p-pubsub/randomsub.go
    • Line 13: warning: exported const RandomSubID should have comment (or a comment on this block) or be unexported (golint)
    • Line 17: warning: exported var RandomSubD should have comment or be unexported (golint)
    • Line 39: warning: exported method RandomSubRouter.Protocols should have comment or be unexported (golint)
    • Line 43: warning: exported method RandomSubRouter.Attach should have comment or be unexported (golint)
    • Line 48: warning: exported method RandomSubRouter.AddPeer should have comment or be unexported (golint)
    • Line 53: warning: exported method RandomSubRouter.RemovePeer should have comment or be unexported (golint)
    • Line 58: warning: exported method RandomSubRouter.EnoughPeers should have comment or be unexported (golint)
    • Line 93: warning: exported method RandomSubRouter.AcceptFrom should have comment or be unexported (golint)
    • Line 97: warning: exported method RandomSubRouter.HandleRPC should have comment or be unexported (golint)
    • Line 99: warning: exported method RandomSubRouter.Publish should have comment or be unexported (golint)
    • Line 162: warning: exported method RandomSubRouter.Join should have comment or be unexported (golint)
    • Line 166: warning: exported method RandomSubRouter.Leave should have comment or be unexported (golint)
    • go-libp2p-pubsub/score.go
    • Line 120: warning: exported type PeerScoreInspectFn should have comment or be unexported (golint)
    • Line 121: warning: exported type ExtendedPeerScoreInspectFn should have comment or be unexported (golint)
    • Line 123: warning: exported type PeerScoreSnapshot should have comment or be unexported (golint)
    • Line 131: warning: exported type TopicScoreSnapshot should have comment or be unexported (golint)
    • go-libp2p-pubsub/tracer.go
    • Line 23: warning: exported var TraceBufferSize should have comment or be unexported (golint)
    • Line 24: warning: exported var MinTraceBatchSize should have comment or be unexported (golint)
    • Line 84: warning: comment on exported function NewJSONTracer should be of the form "NewJSONTracer ..." (golint)
    • Line 137: warning: exported function NewPBTracer should have comment or be unexported (golint)
    • Line 183: warning: exported const RemoteTracerProtoID should have comment or be unexported (golint)
    • go-libp2p-pubsub/notify.go
    • Line 11: warning: exported type PubSubNotif should have comment or be unexported (golint)
    • Line 13: warning: exported method PubSubNotif.OpenedStream should have comment or be unexported (golint)
    • Line 16: warning: exported method PubSubNotif.ClosedStream should have comment or be unexported (golint)
    • Line 19: warning: exported method PubSubNotif.Connected should have comment or be unexported (golint)
    • Line 32: warning: exported method PubSubNotif.Disconnected should have comment or be unexported (golint)
    • Line 35: warning: exported method PubSubNotif.Listen should have comment or be unexported (golint)
    • Line 38: warning: exported method PubSubNotif.ListenClose should have comment or be unexported (golint)
    • Line 41: warning: exported method PubSubNotif.Initialize should have comment or be unexported (golint)
    • go-libp2p-pubsub/pubsub.go
    • Line 26: warning: comment on exported const DefaultMaxMessageSize should be of the form "DefaultMaxMessageSize ..." (golint)
    • Line 30: warning: exported var TimeCacheDuration should have comment or be unexported (golint)
    • Line 189: warning: exported type AcceptStatus should have comment or be unexported (golint)
    • Line 192: warning: comment on exported const AcceptNone should be of the form "AcceptNone ..." (golint)
    • Line 197: warning: comment on exported const AcceptAll should be of the form "AcceptAll ..." (golint)
    • Line 201: warning: exported type Message should have comment or be unexported (golint)
    • Line 207: warning: exported method Message.GetFrom should have comment or be unexported (golint)
    • Line 211: warning: exported type RPC should have comment or be unexported (golint)
    • Line 218: warning: exported type Option should have comment or be unexported (golint)
    • Line 1072: warning: exported type TopicOptions should have comment or be unexported (golint)
    • Line 1074: warning: exported type TopicOpt should have comment or be unexported (golint)
    • Line 1136: warning: exported type SubOpt should have comment or be unexported (golint)
    • Line 1257: warning: exported type RelayCancelFunc should have comment or be unexported (golint)
    • go-libp2p-pubsub/blacklist.go
    • Line 25: warning: exported method MapBlacklist.Add should have comment or be unexported (golint)
    • Line 30: warning: exported method MapBlacklist.Contains should have comment or be unexported (golint)
    • Line 59: warning: exported method TimeCachedBlacklist.Contains should have comment or be unexported (golint)
    • go-libp2p-pubsub/topic.go
    • Line 200: warning: exported type PublishOptions should have comment or be unexported (golint)
    • Line 204: warning: exported type PubOpt should have comment or be unexported (golint)
    • Line 293: warning: exported type EventType should have comment or be unexported (golint)
    • Line 296: warning: exported const PeerJoin should have comment (or a comment on this block) or be unexported (golint)
    • Line 310: warning: exported type TopicEventHandlerOpt should have comment or be unexported (golint)
    • Line 312: warning: exported type PeerEvent should have comment or be unexported (golint)
    • go-libp2p-pubsub/validation.go
    • Line 154: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 291: warning: if block ends with a return statement, so drop this else and outdent its block (golint)

gocyclo100%

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.

No problems detected. Good job!


ineffassign93%

IneffAssign detects ineffectual assignments in Go code.


license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


misspell83%

Misspell Finds commonly misspelled English words