qbeon/webwire-go

View on GitHub

Showing 28 of 32 total issues

Method Socket.Read has 5 return statements (exceeds 4 allowed).
Open

func (sock *Socket) Read(
    msg *message.Message,
    deadline time.Time,
) (err wwr.ErrSockRead) {
    // Set reader lock to ensure there's only one concurrent reader
Severity: Major
Found in transport/memchan/socket.go - About 35 mins to fix

    Method connection.CreateSession has 5 return statements (exceeds 4 allowed).
    Open

    func (con *connection) CreateSession(attachment SessionInfo) error {
        if !con.srv.sessionsEnabled {
            return ErrSessionsDisabled{}
        }
    
    
    Severity: Major
    Found in connection.go - About 35 mins to fix

      Method Socket.Dial has 5 return statements (exceeds 4 allowed).
      Open

      func (sock *Socket) Dial(deadline time.Time) error {
          if sock.sockType != SocketClient {
              return errors.New("cannot dial on a non-client socket")
          }
      
      
      Severity: Major
      Found in transport/memchan/socket.go - About 35 mins to fix

        Method server.handleSessionRestore has 5 return statements (exceeds 4 allowed).
        Open

        func (srv *server) handleSessionRestore(
            con *connection,
            msg *message.Message,
        ) {
            finalize := func() {
        Severity: Major
        Found in handleSessionRestore.go - About 35 mins to fix

          Method server.writeConfMessage has 5 return statements (exceeds 4 allowed).
          Open

          func (srv *server) writeConfMessage(sock Socket) error {
              writer, err := sock.GetWriter()
              if err != nil {
                  return fmt.Errorf(
                      "couldn't get writer for configuration message: %s",
          Severity: Major
          Found in handleConnection.go - About 35 mins to fix

            Function WriteMsgNotifySessionCreated has 5 return statements (exceeds 4 allowed).
            Open

            func WriteMsgNotifySessionCreated(
                writer io.WriteCloser,
                sessionInfo []byte,
            ) error {
                // Write message type flag
            Severity: Major
            Found in message/writeMsgSessionCreated.go - About 35 mins to fix

              Method DefaultSessionManager.OnSessionLookup has 5 return statements (exceeds 4 allowed).
              Open

              func (mng *DefaultSessionManager) OnSessionLookup(key string) (
                  SessionLookupResult,
                  error,
              ) {
                  path := mng.filePath(key)
              Severity: Major
              Found in defaultSessionManager.go - About 35 mins to fix

                Function WriteMsgReply has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                Open

                func WriteMsgReply(
                    writer io.WriteCloser,
                    requestIdentifier []byte,
                    payloadEncoding pld.Encoding,
                    payloadData []byte,
                Severity: Minor
                Found in message/writeMsgReply.go - About 25 mins to fix

                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

                Severity
                Category
                Status
                Source
                Language