Konstantin8105/f4go

View on GitHub

Showing 81 of 81 total issues

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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            percent_error=float(list_results[2][dtype]+list_results[3][dtype])/float(list_results[0][dtype])*100
    Severity: Minor
    Found in testdata/lapack/lapack_testing.py and 1 other location - About 45 mins to fix
    testdata/lapack/lapack_testing.py on lines 304..304

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 35.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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[pos].tok {
                          case token.LPAREN:
                              counter++
                          case token.RPAREN:
                              counter--
      Severity: Major
      Found in fortran/parser.go - About 45 mins to fix

        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

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            print(str(list_results[1][4])+"\n"+str(list_results[2][4]+list_results[3][4]))
        Severity: Major
        Found in testdata/lapack/lapack_testing.py and 2 other locations - About 45 mins to fix
        testdata/lapack/lapack_testing.py on lines 316..316
        testdata/lapack/lapack_testing.py on lines 321..321

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 35.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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 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

              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 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

                  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 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

                      Similar blocks of code found in 3 locations. Consider refactoring.
                      Open

                              print("--> ALL PRECISIONS\t"+str(list_results[0][4])+"\t\t"+str(list_results[1][4])+"\t("+"%.3f" % percent_num_error+"%)\t"+str(list_results[2][4]+list_results[3][4])+"\t("+"%.3f" % percent_error+"%)\t""\n")
                      Severity: Major
                      Found in testdata/lapack/lapack_testing.py and 2 other locations - About 45 mins to fix
                      testdata/lapack/lapack_testing.py on lines 311..311
                      testdata/lapack/lapack_testing.py on lines 316..316

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 35.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Avoid deeply nested control flow statements.
                      Open

                                          if counter == 0 {
                                              break
                                          }
                      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 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

                            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 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