cloudfoundry-community/bosh-cloudstack-cpi

View on GitHub
go_agent/src/code.google.com/p/go.tools/go/types/resolver.go

Summary

Maintainability
F
1 wk
Test Coverage

Method checker.resolveFiles has a Cognitive Complexity of 278 (exceeds 20 allowed). Consider refactoring.
Open

func (check *checker) resolveFiles(files []*ast.File) {
    pkg := check.pkg

    // Phase 1: Pre-declare all package-level objects so that they can be found
    //          independent of source order. Associate methods with receiver
Severity: Minor
Found in go_agent/src/code.google.com/p/go.tools/go/types/resolver.go - About 5 days 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 checker.resolveFiles has 270 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (check *checker) resolveFiles(files []*ast.File) {
    pkg := check.pkg

    // Phase 1: Pre-declare all package-level objects so that they can be found
    //          independent of source order. Associate methods with receiver
Severity: Major
Found in go_agent/src/code.google.com/p/go.tools/go/types/resolver.go - About 1 day to fix

    Method checker.declStmt has a Cognitive Complexity of 60 (exceeds 20 allowed). Consider refactoring.
    Open

    func (check *checker) declStmt(decl ast.Decl) {
        pkg := check.pkg
    
        switch d := decl.(type) {
        case *ast.BadDecl:
    Severity: Minor
    Found in go_agent/src/code.google.com/p/go.tools/go/types/resolver.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

    File resolver.go has 635 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    // Copyright 2013 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package types
    Severity: Minor
    Found in go_agent/src/code.google.com/p/go.tools/go/types/resolver.go - About 5 hrs to fix

      Method checker.declStmt has 69 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (check *checker) declStmt(decl ast.Decl) {
          pkg := check.pkg
      
          switch d := decl.(type) {
          case *ast.BadDecl:
      Severity: Minor
      Found in go_agent/src/code.google.com/p/go.tools/go/types/resolver.go - About 1 hr to fix

        Method checker.typeDecl has 51 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (check *checker) typeDecl(obj *TypeName, typ ast.Expr, def *Named, cycleOk bool) {
            assert(obj.Type() == nil)
        
            // type declarations cannot use iota
            assert(check.iota == nil)
        Severity: Minor
        Found in go_agent/src/code.google.com/p/go.tools/go/types/resolver.go - About 1 hr to fix

          Method checker.typeDecl has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
          Open

          func (check *checker) typeDecl(obj *TypeName, typ ast.Expr, def *Named, cycleOk bool) {
              assert(obj.Type() == nil)
          
              // type declarations cannot use iota
              assert(check.iota == nil)
          Severity: Minor
          Found in go_agent/src/code.google.com/p/go.tools/go/types/resolver.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

          Avoid deeply nested control flow statements.
          Open

                                              if i < len(s.Values) {
                                                  init = s.Values[i]
                                              }
          Severity: Major
          Found in go_agent/src/code.google.com/p/go.tools/go/types/resolver.go - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if i < len(s.Values) {
                                            init = s.Values[i]
                                        }
            Severity: Major
            Found in go_agent/src/code.google.com/p/go.tools/go/types/resolver.go - About 45 mins to fix

              There are no issues that match your filters.

              Category
              Status