Konstantin8105/f4go

View on GitHub

Showing 65 of 81 total issues

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

func (p *parser) parseSubroutine() (decl goast.Decl) {
    Debugf("Parse subroutine")

    defer func() {
        p.init()
Severity: Minor
Found in fortran/parser.go - About 2 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 parser.parseStmt has 287 lines of code (exceeds 250 allowed). Consider refactoring.
Open

func (p *parser) parseStmt() (stmts []goast.Stmt) {
    onlyForRecover := p.ident

    pos := p.ns[p.ident].pos

Severity: Major
Found in fortran/parser.go - About 2 hrs to fix

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

    func (s *scanner) mergeLines() {
        if s.nodes.Len() < 2 {
            return
        }
    merge:
    Severity: Minor
    Found in fortran/scan.go - About 2 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 scanner.scanStrings has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
    Open

    func (s *scanner) scanStrings() {
    again:
        for e := s.nodes.Front(); e != nil; e = e.Next() {
            if e.Value.(*node).tok != ftUndefine {
                continue
    Severity: Minor
    Found in fortran/scan.go - About 2 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 scanner.scanDoubleColon has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
    Open

    func (s *scanner) scanDoubleColon() {
        for e := s.nodes.Front(); e != nil; e = e.Next() {
            if !(e.Value.(*node).tok == ftDoubleColon) {
                continue
            }
    Severity: Minor
    Found in fortran/scan.go - About 2 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 scanner.scanNextComments has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
    Open

    func (s *scanner) scanNextComments() {
    Op:
        var again bool
        for e := s.nodes.Front(); e != nil; e = e.Next() {
            if e.Value.(*node).tok != ftUndefine {
    Severity: Minor
    Found in fortran/scan.go - About 2 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 scanner.scanEmpty has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
    Open

    func (s *scanner) scanEmpty() {
    empty:
        var again bool
        for e := s.nodes.Front(); e != nil; e = e.Next() {
            if e.Value.(*node).tok != ftUndefine {
    Severity: Minor
    Found in fortran/scan.go - About 2 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

    Function intrinsicArgumentCorrection has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
    Open

    func intrinsicArgumentCorrection(p *parser, f *goast.CallExpr, name string, typeNames []string) {
        if _, ok := f.Fun.(*goast.Ident); !ok || len(f.Args) != len(typeNames) {
            return
        }
        f.Fun.(*goast.Ident).Name = name
    Severity: Minor
    Found in fortran/function_definition.go - About 2 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 parser.parseParameter has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring.
    Open

    func (p *parser) parseParameter() (stmts []goast.Stmt) {
        start := p.ident
        p.expect(ftParameter)
        p.ident++
        p.expect(token.LPAREN)
    Severity: Minor
    Found in fortran/parser.go - About 1 hr 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 parser.isComplex has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
    Open

    func (p *parser) isComplex(e goast.Expr) (isComplex, ok bool) {
        if par, ok := e.(*goast.ParenExpr); ok {
            if st, ok := par.X.(*goast.StarExpr); ok {
                if id, ok := st.X.(*goast.Ident); ok {
                    if v, ok := p.initVars.get(id.Name); ok {
    Severity: Minor
    Found in fortran/expression.go - About 1 hr 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 parser.parseData has 266 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    func (p *parser) parseData() (stmts []goast.Stmt) {
        p.expect(ftData)
        p.ident++
    
        // parse names and values
    Severity: Major
    Found in fortran/parser.go - About 1 hr to fix

      Function Parse has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
      Open

      func Parse(b []byte, packageName string) (_ goast.File, errs []error) {
      
          if packageName == "" {
              packageName = "main"
          }
      Severity: Minor
      Found in fortran/parser.go - About 1 hr 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 parser.parseCall has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
      Open

      func (p *parser) parseCall() goast.Stmt {
          {
              begin := p.ident
              p.expect(ftCall)
              p.ident++
      Severity: Minor
      Found in fortran/parser.go - About 1 hr 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 parser.parseDo has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
      Open

      func (p *parser) parseDo() (sDo goast.ForStmt) {
          p.expect(ftDo)
          p.ident++
          if p.ns[p.ident].tok == ftWhile {
              p.ident--
      Severity: Minor
      Found in fortran/parser.go - About 1 hr 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 scanner.postprocessor has 256 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      func (s *scanner) postprocessor() {
          // from:
          // DIMENSION M(100), A(2)
          // to:
          // DIMENSION M(100)
      Severity: Major
      Found in fortran/scan.go - About 1 hr to fix

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

        func (p *parser) parseInit() (stmts []goast.Stmt) {
        
            // parse base type
            var baseType []node
            for ; p.ns[p.ident].tok != token.IDENT; p.ident++ {
        Severity: Minor
        Found in fortran/parser.go - About 1 hr 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 explodeFor has 8 return statements (exceeds 4 allowed).
        Open

        func explodeFor(name []node) (out [][]node, ok bool) {
            // have loop
            if len(name) == 0 {
                return
            }
        Severity: Major
        Found in fortran/parser.go - About 50 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 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 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
                Severity
                Category
                Status
                Source
                Language