johnsonjh/gfcp

View on GitHub

Showing 41 of 59 total issues

Method Snsi.ToSlice has 75 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (
    s *Snsi,
) ToSlice() []string {
    snsi := s.Copy()
    return []string{
Severity: Minor
Found in gfcp_snsi.go - About 2 hrs to fix

    Method Snsi.Copy has 74 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (
        s *Snsi,
    ) Copy() *Snsi {
        d := newSnsi()
        d.GFcpBytesSent = atomic.LoadUint64(
    Severity: Minor
    Found in gfcp_snsi.go - About 1 hr to fix

      Method GFCP.Check has 59 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (
          GFcp *GFCP,
      ) Check() uint32 {
          current := CurrentMs()
          tsFlush := GFcp.tsFlush
      Severity: Minor
      Found in gfcp.go - About 1 hr to fix

        Method FecEncoder.Encode has 53 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (
            enc *FecEncoder,
        ) Encode(
            b []byte,
        ) (
        Severity: Minor
        Found in gfcp_fec.go - About 1 hr to fix

          Method UDPSession.Read has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
          Open

          func (
              s *UDPSession,
          ) Read(
              b []byte,
          ) (
          Severity: Minor
          Found in gfcp_sess.go - About 1 hr 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

          Method GFCP.Send has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
          Open

          func (
              GFcp *GFCP,
          ) Send(
              buffer []byte,
          ) int {
          Severity: Minor
          Found in gfcp.go - About 55 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

          Avoid deeply nested control flow statements.
          Open

                              if GFcp.incr < mss {
                                  GFcp.incr = mss
                              }
          Severity: Major
          Found in gfcp.go - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                            } else if msg.Addr.String() != src {
                                atomic.AddUint64(
                                    &DefaultSnsi.GFcpInputErrors,
                                    1,
                                )
            Severity: Major
            Found in gfcp_readloop_linux.go - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              if numshard == 1 {
                                  first = i
                              }
              Severity: Major
              Found in gfcp_fec.go - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if !shardsflag[k] {
                                        recovered = append(
                                            recovered,
                                            shards[k],
                                        )
                Severity: Major
                Found in gfcp_fec.go - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if ret := s.GFcp.Input(
                                          data[fecHeaderSizePlus2:],
                                          true,
                                          s.ackNoDelay,
                                      ); ret != 0 {
                  Severity: Major
                  Found in gfcp_sess.go - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                    } else if msg.Addr.String() != src {
                                        atomic.AddUint64(
                                            &DefaultSnsi.GFcpPreInputErrors,
                                            1,
                                        )
                    Severity: Major
                    Found in gfcp_readloop_linux.go - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                      } else if k < dec.dataShards {
                                          shards[k] = KxmitBuf.Get().([]byte)[:0]
                                      }
                      Severity: Major
                      Found in gfcp_fec.go - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                        if _itimediff(
                                            sn,
                                            GFcp.rcvNxt,
                                        ) >= 0 {
                                            var GFcpSeg Segment
                        Severity: Major
                        Found in gfcp.go - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if int(
                                                      sz,
                                                  ) <= len(
                                                      r,
                                                  ) && sz >= 2 {
                          Severity: Major
                          Found in gfcp_sess.go - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                            if dec.rx[i].flag() == KTypeData {
                                                numDataShard++
                                            }
                            Severity: Major
                            Found in gfcp_fec.go - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                              if len(
                                                  dec.rx[i].data(),
                                              ) > maxlen {
                                                  maxlen = len(
                                                      dec.rx[i].data(),
                              Severity: Major
                              Found in gfcp_fec.go - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    if (GFcp.cwnd+1)*mss <= GFcp.incr {
                                                        GFcp.cwnd++
                                                    }
                                Severity: Major
                                Found in gfcp.go - About 45 mins to fix

                                  Method GFCP.Input has 6 return statements (exceeds 4 allowed).
                                  Open

                                  func (
                                      GFcp *GFCP,
                                  ) Input(
                                      data []byte,
                                      regular,
                                  Severity: Major
                                  Found in gfcp.go - About 40 mins to fix

                                    Method UDPSession.Read has 6 return statements (exceeds 4 allowed).
                                    Open

                                    func (
                                        s *UDPSession,
                                    ) Read(
                                        b []byte,
                                    ) (
                                    Severity: Major
                                    Found in gfcp_sess.go - About 40 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language