cloudfoundry-community/bosh-cloudstack-cpi

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

Summary

Maintainability
D
2 days
Test Coverage

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

func (check *checker) selector(x *operand, e *ast.SelectorExpr) {
    // these must be declared before the "goto Error" statements
    var (
        obj      Object
        index    []int
Severity: Minor
Found in go_agent/src/code.google.com/p/go.tools/go/types/call.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 checker.selector has 126 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (check *checker) selector(x *operand, e *ast.SelectorExpr) {
    // these must be declared before the "goto Error" statements
    var (
        obj      Object
        index    []int
Severity: Major
Found in go_agent/src/code.google.com/p/go.tools/go/types/call.go - About 4 hrs to fix

    Method checker.call has 56 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (check *checker) call(x *operand, e *ast.CallExpr) exprKind {
        check.exprOrType(x, e.Fun)
    
        switch x.mode {
        case invalid:
    Severity: Minor
    Found in go_agent/src/code.google.com/p/go.tools/go/types/call.go - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                          if _, ok := typ.(*Pointer); !ok && !isInterface(typ) {
                              typ = &Pointer{base: typ}
                          }
      Severity: Major
      Found in go_agent/src/code.google.com/p/go.tools/go/types/call.go - About 45 mins to fix

        Method checker.arguments has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func (check *checker) arguments(x *operand, call *ast.CallExpr, sig *Signature, arg getter, n int) {
        Severity: Minor
        Found in go_agent/src/code.google.com/p/go.tools/go/types/call.go - About 35 mins to fix

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

          func unpack(get getter, n int, allowCommaOk bool) (getter, int, bool) {
              if n == 1 {
                  // possibly result of an n-valued function call or comma,ok value
                  var x0 operand
                  get(&x0, 0)
          Severity: Major
          Found in go_agent/src/code.google.com/p/go.tools/go/types/call.go - About 35 mins to fix

            Method checker.call has 5 return statements (exceeds 4 allowed).
            Open

            func (check *checker) call(x *operand, e *ast.CallExpr) exprKind {
                check.exprOrType(x, e.Fun)
            
                switch x.mode {
                case invalid:
            Severity: Major
            Found in go_agent/src/code.google.com/p/go.tools/go/types/call.go - About 35 mins to fix

              There are no issues that match your filters.

              Category
              Status