Konstantin8105/f4go

View on GitHub

Showing 65 of 81 total issues

Method scanner.scanTokensAfter has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
Open

func (s *scanner) scanTokensAfter() {
    entities := []struct {
        tok     token.Token
        pattern []string
    }{
Severity: Minor
Found in fortran/scan.go - About 45 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

                    switch p.ns[pos].tok {
                    case token.LPAREN:
                        counter++
                    case token.RPAREN:
                        counter--
Severity: Major
Found in fortran/parser.go - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if par2, ok := par.X.(*goast.ParenExpr); ok {
                                if st, ok := par2.X.(*goast.StarExpr); ok {
                                    call.Args[i] = st.X
                                }
                            }
    Severity: Major
    Found in fortran/function_definition.go - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if en < len(e.Value.(*node).b) &&
                              (isFloatLetter(e.Value.(*node).b[en])) {
                              if en+1 < len(e.Value.(*node).b) &&
                                  (e.Value.(*node).b[en+1] == '+' || e.Value.(*node).b[en+1] == '-') {
                                  en++
      Severity: Major
      Found in fortran/scan.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 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 len(f.b) > 1 {
                                    s += "%" + string(f.b[1:]) + "s"
                                } else {
                                    s += "%s"
                                }
            Severity: Major
            Found in fortran/io.go - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if i+1 < len(fs) && fs[i+1].tok == token.INT {
                                      s += string(fs[i+1].b)
                                      i += 1
                                  }
              Severity: Major
              Found in fortran/io.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

                                      switch p.ns[p.ident].tok {
                                      case token.LPAREN:
                                          counter++
                                      case token.RPAREN:
                                          counter--
                  Severity: Major
                  Found in fortran/parser.go - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if strings.Contains(arg.Name, "func()*[]byte{y:=[]byte(") {
                                                arg.Name = arg.Name[17:]
                                                index := strings.LastIndex(arg.Name, "\")")
                                                arg.Name = arg.Name[:index+2]
                                                if i > 1 {
                    Severity: Major
                    Found in fortran/function_definition.go - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if len(arg.Name) > 3 && arg.Name[:2] == "&(" {
                                                  arg.Name = arg.Name[2 : len(arg.Name)-1]
                                                  continue
                                              }
                      Severity: Major
                      Found in fortran/function_definition.go - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if e.Value.(*node).b[en] == '.' {
                                                for en = en + 1; en < len(e.Value.(*node).b); en++ {
                                                    if !isDigit(e.Value.(*node).b[en]) {
                                                        break
                                                    }
                        Severity: Major
                        Found in fortran/scan.go - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              if i+1 < len(fs) && fs[i+1].tok == token.INT {
                                                  s += string(fs[i+1].b)
                                                  i += 1
                                              }
                          Severity: Major
                          Found in fortran/io.go - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

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

                              Avoid deeply nested control flow statements.
                              Open

                                                      if st, ok := par.X.(*goast.StarExpr); ok {
                                                          call.Args[i] = st.X
                                                      }
                              Severity: Major
                              Found in fortran/function_definition.go - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    if !isDigit(e.Value.(*node).b[en]) {
                                                        break
                                                    }
                                Severity: Major
                                Found in fortran/scan.go - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if par, ok := un.X.(*goast.ParenExpr); ok {
                                                              if id, ok := par.X.(*goast.IndexExpr); ok {
                                                                  call.Args[i] = id
                                                                  continue
                                                              }
                                  Severity: Major
                                  Found in fortran/function_definition.go - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

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

                                      Avoid deeply nested control flow statements.
                                      Open

                                                              if len(arg.Name) > 10 && arg.Name[:7] == "func()*" {
                                                                  arg.Name = "*" + arg.Name
                                                                  continue
                                                              }
                                      Severity: Major
                                      Found in fortran/function_definition.go - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language