Konstantin8105/f4go

View on GitHub
fortran/expression.go

Summary

Maintainability
C
1 day
Test Coverage

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

func (p *parser) fixComplexValue(nodes *[]node) {
    var start, comma, end int
    var find bool
    for i := range *nodes {
        if i != 0 {
Severity: Minor
Found in fortran/expression.go - About 4 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.fixArrayVariables has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
Open

func (p *parser) fixArrayVariables(nodes *[]node) {
    var positions []int
    // find all arrays
    for i, n := range *nodes {
        if n.tok == token.IDENT && p.isArrayVariable(string(n.b)) {
Severity: Minor
Found in fortran/expression.go - About 3 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.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

Avoid deeply nested control flow statements.
Open

                    if strings.Contains(v.typ.getBaseType(), "complex") {
                        return true, true
                    } else {
                        return false, true
                    }
Severity: Major
Found in fortran/expression.go - About 45 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

      There are no issues that match your filters.

      Category
      Status