Konstantin8105/f4go

View on GitHub
fortran/function_definition.go

Summary

Maintainability
D
2 days
Test Coverage

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

func (in intrinsic) Visit(node goast.Node) (w goast.Visitor) {

    if call, ok := node.(*goast.CallExpr); ok {
        if n, ok := call.Fun.(*goast.Ident); ok {
            if f, ok := intrinsicFunction[strings.ToUpper(n.Name)]; ok {
Severity: Minor
Found in fortran/function_definition.go - About 1 day 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 callArgumentSimplification.Visit has a Cognitive Complexity of 60 (exceeds 20 allowed). Consider refactoring.
Open

func (c callArgumentSimplification) Visit(node goast.Node) (w goast.Visitor) {
    // from : &((*a))
    // to   : a
    if id, ok := node.(*goast.Ident); ok {
        if len(id.Name) > 6 && id.Name[:4] == "&((*" {
Severity: Minor
Found in fortran/function_definition.go - About 6 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

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

              There are no issues that match your filters.

              Category
              Status