synapsecns/sanguine

View on GitHub
core/ginhelper/gindump.go

Summary

Maintainability
F
3 days
Test Coverage

Function DumpWithOptions has a Cognitive Complexity of 139 (exceeds 20 allowed). Consider refactoring.
Open

func DumpWithOptions(showReq bool, showResp bool, showBody bool, showHeaders bool, showCookies bool, cb func(dumpStr string)) gin.HandlerFunc {
    headerHiddenFields := make([]string, 0)
    bodyHiddenFields := make([]string, 0)

    if !showCookies {
Severity: Minor
Found in core/ginhelper/gindump.go - About 2 days 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

Function DumpWithOptions has 114 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func DumpWithOptions(showReq bool, showResp bool, showBody bool, showHeaders bool, showCookies bool, cb func(dumpStr string)) gin.HandlerFunc {
    headerHiddenFields := make([]string, 0)
    bodyHiddenFields := make([]string, 0)

    if !showCookies {
Severity: Major
Found in core/ginhelper/gindump.go - About 3 hrs to fix

    Function DumpWithOptions has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func DumpWithOptions(showReq bool, showResp bool, showBody bool, showHeaders bool, showCookies bool, cb func(dumpStr string)) gin.HandlerFunc {
    Severity: Minor
    Found in core/ginhelper/gindump.go - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              goto DumpRes
      Severity: Major
      Found in core/ginhelper/gindump.go - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                goto DumpRes
        Severity: Major
        Found in core/ginhelper/gindump.go - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  goto DumpRes
          Severity: Major
          Found in core/ginhelper/gindump.go - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    goto DumpRes
            Severity: Major
            Found in core/ginhelper/gindump.go - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      goto End
              Severity: Major
              Found in core/ginhelper/gindump.go - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        goto DumpRes
                Severity: Major
                Found in core/ginhelper/gindump.go - About 45 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status