Konstantin8105/f4go

View on GitHub

Showing 65 of 81 total issues

Avoid deeply nested control flow statements.
Open

                    if ok {
                        // add init
                        var inject []node
                        inject = append(inject, typ...)
                        for i := start; i < pos; i++ {
Severity: Major
Found in fortran/parser.go - About 45 mins to fix

    Method parser.parseStmt has 6 return statements (exceeds 4 allowed).
    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 40 mins to fix

      Method parser.isComplex has 5 return statements (exceeds 4 allowed).
      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: Major
      Found in fortran/expression.go - About 35 mins to fix

        Method goType.getMinLimit has 5 return statements (exceeds 4 allowed).
        Open

        func (g goType) getMinLimit(col int) (size int, ok bool) {
            if !g.isArray() {
                return
            }
            if col > len(g.arrayNode) {
        Severity: Major
        Found in fortran/type.go - About 35 mins to fix

          Method strChanger.Visit has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
          Open

          func (s strChanger) Visit(node goast.Node) (w goast.Visitor) {
              if call, ok := node.(*goast.CallExpr); ok {
                  if sel, ok := call.Fun.(*goast.SelectorExpr); ok {
                      if id, ok := sel.X.(*goast.Ident); ok {
                          if id.Name == "fmt" || id.Name == "math" {
          Severity: Minor
          Found in fortran/parser.go - About 35 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

          Severity
          Category
          Status
          Source
          Language