Showing 28 of 32 total issues
Method Socket.Read
has 5 return statements (exceeds 4 allowed). Open
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
Method connection.CreateSession
has 5 return statements (exceeds 4 allowed). Open
Open
func (con *connection) CreateSession(attachment SessionInfo) error {
if !con.srv.sessionsEnabled {
return ErrSessionsDisabled{}
}
Method Socket.Dial
has 5 return statements (exceeds 4 allowed). Open
Open
func (sock *Socket) Dial(deadline time.Time) error {
if sock.sockType != SocketClient {
return errors.New("cannot dial on a non-client socket")
}
Method server.handleSessionRestore
has 5 return statements (exceeds 4 allowed). Open
Open
func (srv *server) handleSessionRestore(
con *connection,
msg *message.Message,
) {
finalize := func() {
Method server.writeConfMessage
has 5 return statements (exceeds 4 allowed). Open
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",
Function WriteMsgNotifySessionCreated
has 5 return statements (exceeds 4 allowed). Open
Open
func WriteMsgNotifySessionCreated(
writer io.WriteCloser,
sessionInfo []byte,
) error {
// Write message type flag
Method DefaultSessionManager.OnSessionLookup
has 5 return statements (exceeds 4 allowed). Open
Open
func (mng *DefaultSessionManager) OnSessionLookup(key string) (
SessionLookupResult,
error,
) {
path := mng.filePath(key)
Function WriteMsgReply
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
Open
func WriteMsgReply(
writer io.WriteCloser,
requestIdentifier []byte,
payloadEncoding pld.Encoding,
payloadData []byte,
- 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"