Konstantin8105/f4go

View on GitHub
fortran/util.go

Summary

Maintainability
F
3 days
Test Coverage

Method parser.split has a Cognitive Complexity of 166 (exceeds 20 allowed). Consider refactoring.
Open

func (p *parser) split(nodes *[]node, pos int) (
    leftOther, leftVariable []node,
    rightVariable, rightOther []node) {

    // Example of possible variables:
Severity: Minor
Found in fortran/util.go - About 3 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

Avoid deeply nested control flow statements.
Open

                    if rightSeparator+1 < len(rightPart) &&
                        rightPart[rightSeparator+1].tok == token.LPAREN {
                        rightSeparator++
                        counter := 0
                        for {
Severity: Major
Found in fortran/util.go - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if rightPart[rightSeparator].tok == token.LPAREN {
                            counter++
                        }
    Severity: Major
    Found in fortran/util.go - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if rightPart[rightSeparator].tok == token.RPAREN {
                              counter--
                          }
      Severity: Major
      Found in fortran/util.go - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if rightSeparator+1 <= len(rightPart) {
                                for {
                                    if rightPart[rightSeparator].tok == token.LBRACK {
                                        counter++
                                    }
        Severity: Major
        Found in fortran/util.go - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if counter == 0 {
                                  break
                              }
          Severity: Major
          Found in fortran/util.go - About 45 mins to fix

            There are no issues that match your filters.

            Category
            Status