cloudfoundry-community/bosh-cloudstack-cpi

View on GitHub
go_agent/src/code.google.com/p/go.tools/importer/source.go

Summary

Maintainability
D
2 days
Test Coverage

Function childrenOf has 193 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func childrenOf(n ast.Node) []ast.Node {
    var children []ast.Node

    // First add nodes for all true subtrees.
    ast.Inspect(n, func(node ast.Node) bool {
Severity: Major
Found in go_agent/src/code.google.com/p/go.tools/importer/source.go - About 6 hrs to fix

    Function NodeDescription has 134 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func NodeDescription(n ast.Node) string {
        switch n := n.(type) {
        case *ast.ArrayType:
            return "array type"
        case *ast.AssignStmt:
    Severity: Major
    Found in go_agent/src/code.google.com/p/go.tools/importer/source.go - About 4 hrs to fix

      Function PathEnclosingInterval has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
      Open

      func PathEnclosingInterval(root *ast.File, start, end token.Pos) (path []ast.Node, exact bool) {
          // fmt.Printf("EnclosingInterval %d %d\n", start, end) // debugging
      
          // Precondition: node.[Pos..End) and adjoining whitespace contain [start, end).
          var visit func(node ast.Node) bool
      Severity: Minor
      Found in go_agent/src/code.google.com/p/go.tools/importer/source.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

      Function childrenOf has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
      Open

      func childrenOf(n ast.Node) []ast.Node {
          var children []ast.Node
      
          // First add nodes for all true subtrees.
          ast.Inspect(n, func(node ast.Node) bool {
      Severity: Minor
      Found in go_agent/src/code.google.com/p/go.tools/importer/source.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 PathEnclosingInterval has 56 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func PathEnclosingInterval(root *ast.File, start, end token.Pos) (path []ast.Node, exact bool) {
          // fmt.Printf("EnclosingInterval %d %d\n", start, end) // debugging
      
          // Precondition: node.[Pos..End) and adjoining whitespace contain [start, end).
          var visit func(node ast.Node) bool
      Severity: Minor
      Found in go_agent/src/code.google.com/p/go.tools/importer/source.go - About 1 hr to fix

        Function PathEnclosingInterval has 5 return statements (exceeds 4 allowed).
        Open

        func PathEnclosingInterval(root *ast.File, start, end token.Pos) (path []ast.Node, exact bool) {
            // fmt.Printf("EnclosingInterval %d %d\n", start, end) // debugging
        
            // Precondition: node.[Pos..End) and adjoining whitespace contain [start, end).
            var visit func(node ast.Node) bool
        Severity: Major
        Found in go_agent/src/code.google.com/p/go.tools/importer/source.go - About 35 mins to fix

          There are no issues that match your filters.

          Category
          Status