Showing 400 of 400 total issues
Function execute
has 7 return statements (exceeds 4 allowed). Open
func execute(options Options) {
var err error
hostAddr, _ := net.ResolveTCPAddr("tcp", fmt.Sprintf("0.0.0.0:%d", options.Port))
if options.NodeKey == nil {
Method StaticShardingPubsubTopic.Parse
has 7 return statements (exceeds 4 allowed). Open
func (s *StaticShardingPubsubTopic) Parse(topic string) error {
if !strings.HasPrefix(topic, StaticShardingPubsubTopicPrefix) {
return ErrInvalidShardedTopicPrefix
}
Method WakuStore.queryFrom
has 7 return statements (exceeds 4 allowed). Open
func (s *WakuStore) queryFrom(ctx context.Context, storeRequest *pb.StoreQueryRequest, params *Parameters) (*pb.StoreQueryResponse, error) {
logger := s.log.With(logging.HostID("peer", params.selectedPeer), zap.String("requestId", storeRequest.RequestId))
logger.Debug("sending store request")
Function waku_content_topic
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func waku_content_topic(applicationName *C.char, applicationVersion *C.char, contentTopicName *C.char, encoding *C.char, cb C.WakuCallBack, userData unsafe.Pointer) C.int {
Method WakuPeerExchange.Request
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
func (wakuPX *WakuPeerExchange) Request(ctx context.Context, numPeers int, opts ...RequestOption) error {
params := new(PeerExchangeRequestParameters)
params.host = wakuPX.h
params.log = wakuPX.log
params.pm = wakuPX.pm
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function waku_filter_subscribe
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func waku_filter_subscribe(ctx unsafe.Pointer, filterJSON *C.char, peerID *C.char, ms C.int, cb C.WakuCallBack, userData unsafe.Pointer) C.int {
Function waku_dns_discovery
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func waku_dns_discovery(ctx unsafe.Pointer, url *C.char, nameserver *C.char, ms C.int, cb C.WakuCallBack, userData unsafe.Pointer) C.int {
Method WakuFilterLightNode.Unsubscribe
has 7 return statements (exceeds 4 allowed). Open
func (wf *WakuFilterLightNode) Unsubscribe(ctx context.Context, contentFilter protocol.ContentFilter, opts ...FilterSubscribeOption) (*WakuFilterPushResult, error) {
wf.RLock()
defer wf.RUnlock()
if err := wf.ErrOnNotRunning(); err != nil {
return nil, err
Method Payload.Encode
has 7 return statements (exceeds 4 allowed). Open
func (payload Payload) Encode(version uint32) ([]byte, error) {
switch version {
case 0:
return payload.Data, nil
case 1:
Function NewWakuRelay
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func NewWakuRelay(bcaster Broadcaster, minPeersToPublish int, timesource timesource.Timesource,
reg prometheus.Registerer, log *zap.Logger, opts ...RelayOption) *WakuRelay {
Method WakuPeerExchange.onRequest
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
func (wakuPX *WakuPeerExchange) onRequest() func(network.Stream) {
return func(stream network.Stream) {
logger := wakuPX.log.With(logging.HostID("peer", stream.Conn().RemotePeer()))
if wakuPX.limiter != nil && !wakuPX.limiter.Allow() {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function DecodeAsymmetric
has 7 return statements (exceeds 4 allowed). Open
func DecodeAsymmetric(messageJSON string, privateKey string) (string, error) {
var msg pb.WakuMessage
err := json.Unmarshal([]byte(messageJSON), &msg)
if err != nil {
return "", err
Function StringToQR
has 7 return statements (exceeds 4 allowed). Open
func StringToQR(qrString string) (QR, error) {
values := strings.Split(qrString, ":")
if len(values) != 5 {
return QR{}, errors.New("invalid qr string")
}
Function waku_store_query
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func waku_store_query(ctx unsafe.Pointer, queryJSON *C.char, peerID *C.char, ms C.int, cb C.WakuCallBack, userData unsafe.Pointer) C.int {
Function waku_filter_unsubscribe
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func waku_filter_unsubscribe(ctx unsafe.Pointer, filterJSON *C.char, peerID *C.char, ms C.int, cb C.WakuCallBack, userData unsafe.Pointer) C.int {
Function NewWakuFilterLightNode
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
broadcaster relay.Broadcaster,
pm *peermanager.PeerManager,
timesource timesource.Timesource,
onlineChecker onlinechecker.OnlineChecker,
reg prometheus.Registerer,
Method WakuFilterLightNode.Subscribe
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
func (wf *WakuFilterLightNode) Subscribe(ctx context.Context, contentFilter protocol.ContentFilter, opts ...FilterSubscribeOption) ([]*subscription.SubscriptionDetails, error) {
wf.RLock()
defer wf.RUnlock()
if err := wf.ErrOnNotRunning(); err != nil {
return nil, err
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function waku_relay_publish
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func waku_relay_publish(ctx unsafe.Pointer, messageJSON *C.char, topic *C.char, ms C.int, cb C.WakuCallBack, userData unsafe.Pointer) C.int {
Function validateInstance
has 7 return statements (exceeds 4 allowed). Open
func validateInstance(instance *WakuInstance, validationType ValidationType) error {
if instance == nil {
return errWakuNodeNotReady
}
Function EncodeSymmetric
has 7 return statements (exceeds 4 allowed). Open
func EncodeSymmetric(messageJSON string, symmetricKey string, optionalSigningKey string) (string, error) {
msg, err := wakuMessage(messageJSON)
if err != nil {
return "", err
}