elves/elvish

View on GitHub
pkg/parse/parse.go

Summary

Maintainability
C
7 hrs
Test Coverage

Method Primary.doubleQuotedInner has a Cognitive Complexity of 54 (exceeds 20 allowed). Consider refactoring.
Open

func (pn *Primary) doubleQuotedInner(ps *parser) {
    var buf bytes.Buffer
    defer func() { pn.Value = buf.String() }()
    for {
        switch r := ps.next(); r {
Severity: Minor
Found in pkg/parse/parse.go - About 5 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

Avoid deeply nested control flow statements.
Open

                    if !ok {
                        ps.backup()
                        ps.error(errInvalidEscapeHex)
                        break
                    }
Severity: Major
Found in pkg/parse/parse.go - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if r < '0' || r > '7' {
                            ps.backup()
                            ps.error(errInvalidEscapeOct)
                            break
                        }
    Severity: Major
    Found in pkg/parse/parse.go - About 45 mins to fix

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

      func parseSpacesInner(n Node, ps *parser, newlines bool) {
      spaces:
          for {
              r := ps.peek()
              switch {
      Severity: Minor
      Found in pkg/parse/parse.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

      There are no issues that match your filters.

      Category
      Status