johnsonjh/gfcp

View on GitHub

Showing 59 of 59 total issues

File gfcp.go has 1436 lines of code (exceeds 500 allowed). Consider refactoring.
Open

// Package gfcp - A Fast and Reliable ARQ Protocol
//
// Copyright © 2021 Jeffrey H. Johnson <trnsz@pobox.com>.
// Copyright © 2015 Daniel Fu <daniel820313@gmail.com>.
// Copyright © 2019 Loki 'l0k18' Verloren <stalker.loki@protonmail.ch>.
Severity: Major
Found in gfcp.go - About 3 days to fix

    File gfcp_sess.go has 1283 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    // Copyright © 2021 Jeffrey H. Johnson <trnsz@pobox.com>.
    // Copyright © 2015 Daniel Fu <daniel820313@gmail.com>.
    // Copyright © 2019 Loki 'l0k18' Verloren <stalker.loki@protonmail.ch>.
    // Copyright © 2021 Gridfinity, LLC. <admin@gridfinity.com>.
    //
    Severity: Major
    Found in gfcp_sess.go - About 2 days to fix

      Method GFCP.Flush has 275 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (
          GFcp *GFCP,
      ) Flush(
          ackOnly bool,
      ) uint32 {
      Severity: Major
      Found in gfcp.go - About 1 day to fix

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

        func (
            s *UDPSession,
        ) GFcpInput(
            data []byte,
        ) {
        Severity: Minor
        Found in gfcp_sess.go - About 1 day 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.Flush has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring.
        Open

        func (
            GFcp *GFCP,
        ) Flush(
            ackOnly bool,
        ) uint32 {
        Severity: Minor
        Found in gfcp.go - About 7 hrs 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.Input has a Cognitive Complexity of 60 (exceeds 20 allowed). Consider refactoring.
        Open

        func (
            GFcp *GFCP,
        ) Input(
            data []byte,
            regular,
        Severity: Minor
        Found in gfcp.go - About 6 hrs 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.Input has 184 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

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

          Method FecDecoder.Decode has a Cognitive Complexity of 55 (exceeds 20 allowed). Consider refactoring.
          Open

          func (
              dec *FecDecoder,
          ) Decode(
              in FecPacket,
          ) (
          Severity: Minor
          Found in gfcp_fec.go - About 6 hrs 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 FecDecoder.Decode has 142 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (
              dec *FecDecoder,
          ) Decode(
              in FecPacket,
          ) (
          Severity: Major
          Found in gfcp_fec.go - About 4 hrs to fix

            Method UDPSession.GFcpInput has 133 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (
                s *UDPSession,
            ) GFcpInput(
                data []byte,
            ) {
            Severity: Major
            Found in gfcp_sess.go - About 4 hrs to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              func (
                  s *UDPSession,
              ) readLoopIPv6() {
                  var src string
                  msgs := make(
              Severity: Major
              Found in gfcp_readloop_linux.go and 1 other location - About 3 hrs to fix
              gfcp_readloop_linux.go on lines 95..144

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 305.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              func (
                  s *UDPSession,
              ) readLoopIPv4() {
                  var src string
                  msgs := make(
              Severity: Major
              Found in gfcp_readloop_linux.go and 1 other location - About 3 hrs to fix
              gfcp_readloop_linux.go on lines 42..93

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 305.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              UDPSession has 27 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  UDPSession struct {
                      updaterIdx int            // record slice index in updater
                      conn       net.PacketConn // the underlying packet connection
                      GFcp       *GFCP          // GFCP ARQ protocol
                      l          *Listener      // pointing to the Listener object if it's been accepted by a Listener
              Severity: Minor
              Found in gfcp_sess.go - About 3 hrs to fix

                Method GFCP.Send has 104 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (
                    GFcp *GFCP,
                ) Send(
                    buffer []byte,
                ) int {
                Severity: Major
                Found in gfcp.go - About 3 hrs to fix

                  Method Snsi.Reset has 96 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (s *Snsi) Reset() {
                      atomic.StoreUint64(
                          &s.GFcpBytesSent,
                          0,
                      )
                  Severity: Major
                  Found in gfcp_snsi.go - About 2 hrs to fix

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    func (
                        l *Listener,
                    ) monitorIPv4() {
                        msgs := make(
                            []ipv4.Message,
                    Severity: Major
                    Found in gfcp_readloop_linux.go and 1 other location - About 2 hrs to fix
                    gfcp_readloop_linux.go on lines 201..240

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 229.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    func (
                        l *Listener,
                    ) monitorIPv6() {
                        msgs := make(
                            []ipv6.Message,
                    Severity: Major
                    Found in gfcp_readloop_linux.go and 1 other location - About 2 hrs to fix
                    gfcp_readloop_linux.go on lines 160..199

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 229.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Method UDPSession.Read has 91 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (
                        s *UDPSession,
                    ) Read(
                        b []byte,
                    ) (
                    Severity: Major
                    Found in gfcp_sess.go - About 2 hrs to fix

                      Function newUDPSession has 89 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func newUDPSession(
                          conv uint32,
                          dataShards,
                          parityShards int,
                          l *Listener,
                      Severity: Major
                      Found in gfcp_sess.go - About 2 hrs to fix

                        GFCP has 23 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        type GFCP struct {
                            conv, mtu, mss, state               uint32
                            sndUna, sndNxt, rcvNxt              uint32
                            ssthresh                            uint32
                            rxRttVar, rxSrtt                    int32
                        Severity: Minor
                        Found in gfcp.go - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language