cloudfoundry-community/bosh-cloudstack-cpi

View on GitHub
go_agent/src/code.google.com/p/go.tools/ssa/builder.go

Summary

Maintainability
F
1 wk
Test Coverage

File builder.go has 1652 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 ssa
Severity: Major
Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.go - About 3 days to fix

    Method builder.stmt has a Cognitive Complexity of 73 (exceeds 20 allowed). Consider refactoring.
    Open

    func (b *builder) stmt(fn *Function, _s ast.Stmt) {
        // The label of the current statement.  If non-nil, its _goto
        // target is always set; its _break and _continue are set only
        // within the body of switch/typeswitch/select/for/range.
        // It is effectively an additional default-nil parameter of stmt().
    Severity: Minor
    Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.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 builder.expr0 has 195 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (b *builder) expr0(fn *Function, e ast.Expr) Value {
        switch e := e.(type) {
        case *ast.BasicLit:
            panic("non-constant BasicLit") // unreachable
    
    
    Severity: Major
    Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.go - About 6 hrs to fix

      Method builder.stmt has 149 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (b *builder) stmt(fn *Function, _s ast.Stmt) {
          // The label of the current statement.  If non-nil, its _goto
          // target is always set; its _break and _continue are set only
          // within the body of switch/typeswitch/select/for/range.
          // It is effectively an additional default-nil parameter of stmt().
      Severity: Major
      Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.go - About 4 hrs to fix

        Method builder.expr0 has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring.
        Open

        func (b *builder) expr0(fn *Function, e ast.Expr) Value {
            switch e := e.(type) {
            case *ast.BasicLit:
                panic("non-constant BasicLit") // unreachable
        
        
        Severity: Minor
        Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.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 builder.selectStmt has 142 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (b *builder) selectStmt(fn *Function, s *ast.SelectStmt, label *lblock) {
            // A blocking select of a single case degenerates to a
            // simple send or receive.
            // TODO(adonovan): opt: is this optimization worth its weight?
            if len(s.Body.List) == 1 {
        Severity: Major
        Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.go - About 4 hrs to fix

          Method builder.selectStmt has a Cognitive Complexity of 44 (exceeds 20 allowed). Consider refactoring.
          Open

          func (b *builder) selectStmt(fn *Function, s *ast.SelectStmt, label *lblock) {
              // A blocking select of a single case degenerates to a
              // simple send or receive.
              // TODO(adonovan): opt: is this optimization worth its weight?
              if len(s.Body.List) == 1 {
          Severity: Minor
          Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.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

          builder has 30 methods (exceeds 20 allowed). Consider refactoring.
          Open

          type builder struct{}
          Severity: Minor
          Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.go - About 3 hrs to fix

            Method builder.compLit has 82 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (b *builder) compLit(fn *Function, addr Value, e *ast.CompositeLit) {
                typ := deref(fn.Pkg.typeOf(e))
                switch t := typ.Underlying().(type) {
                case *types.Struct:
                    for i, e := range e.Elts {
            Severity: Major
            Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.go - About 2 hrs to fix

              Method Package.Build has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
              Open

              func (p *Package) Build() {
                  if !atomic.CompareAndSwapInt32(&p.started, 0, 1) {
                      return // already started
                  }
                  if p.info == nil {
              Severity: Minor
              Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.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

              Method builder.compLit has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
              Open

              func (b *builder) compLit(fn *Function, addr Value, e *ast.CompositeLit) {
                  typ := deref(fn.Pkg.typeOf(e))
                  switch t := typ.Underlying().(type) {
                  case *types.Struct:
                      for i, e := range e.Elts {
              Severity: Minor
              Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.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

              Method builder.addr has 75 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (b *builder) addr(fn *Function, e ast.Expr, escaping bool) lvalue {
                  switch e := e.(type) {
                  case *ast.Ident:
                      if isBlankIdent(e) {
                          return blank{}
              Severity: Minor
              Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.go - About 2 hrs to fix

                Method Package.Build has 69 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (p *Package) Build() {
                    if !atomic.CompareAndSwapInt32(&p.started, 0, 1) {
                        return // already started
                    }
                    if p.info == nil {
                Severity: Minor
                Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.go - About 1 hr to fix

                  Method builder.expr0 has 17 return statements (exceeds 4 allowed).
                  Open

                  func (b *builder) expr0(fn *Function, e ast.Expr) Value {
                      switch e := e.(type) {
                      case *ast.BasicLit:
                          panic("non-constant BasicLit") // unreachable
                  
                  
                  Severity: Major
                  Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.go - About 1 hr to fix

                    Method builder.switchStmt has 62 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (b *builder) switchStmt(fn *Function, s *ast.SwitchStmt, label *lblock) {
                        // We treat SwitchStmt like a sequential if-else chain.
                        // More efficient strategies (e.g. multiway dispatch)
                        // are possible if all cases are free of side effects.
                        if s.Init != nil {
                    Severity: Minor
                    Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.go - About 1 hr to fix

                      Method Package.needMethods has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (p *Package) needMethods(T types.Type, skip bool) {
                          // Each package maintains its own set of types it has visited.
                          if p.needRTTI.Set(T, true) != nil {
                              return // already seen
                          }
                      Severity: Minor
                      Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.go - About 1 hr to fix

                        Method builder.rangeIndexed has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (b *builder) rangeIndexed(fn *Function, x Value, tv types.Type) (k, v Value, loop, done *BasicBlock) {
                            //
                            //      length = len(x)
                            //      index = -1
                            // loop:                                   (target of continue)
                        Severity: Minor
                        Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.go - About 1 hr to fix

                          Method builder.builtin has 54 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (b *builder) builtin(fn *Function, obj *types.Builtin, args []ast.Expr, typ types.Type, pos token.Pos) Value {
                              switch obj.Name() {
                              case "make":
                                  switch typ.Underlying().(type) {
                                  case *types.Slice:
                          Severity: Minor
                          Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.go - About 1 hr to fix

                            Method builder.rangeStmt has 54 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (b *builder) rangeStmt(fn *Function, s *ast.RangeStmt, label *lblock) {
                                var tk, tv types.Type
                                if !isBlankIdent(s.Key) {
                                    tk = fn.Pkg.typeOf(s.Key)
                                }
                            Severity: Minor
                            Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.go - About 1 hr to fix

                              Method builder.typeSwitchStmt has 53 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func (b *builder) typeSwitchStmt(fn *Function, s *ast.TypeSwitchStmt, label *lblock) {
                                  // We treat TypeSwitchStmt like a sequential if-else
                                  // chain.  More efficient strategies (e.g. multiway
                                  // dispatch) are possible.
                              
                              
                              Severity: Minor
                              Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.go - About 1 hr to fix

                                Method builder.emitCallArgs has 51 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func (b *builder) emitCallArgs(fn *Function, sig *types.Signature, e *ast.CallExpr, args []Value) []Value {
                                    // f(x, y, z...): pass slice z straight through.
                                    if e.Ellipsis != 0 {
                                        for i, arg := range e.Args {
                                            v := emitConv(fn, b.expr(fn, arg), sig.Params().At(i).Type())
                                Severity: Minor
                                Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.go - About 1 hr to fix

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

                                  func (b *builder) assignStmt(fn *Function, lhss, rhss []ast.Expr, isDef bool) {
                                      // Side effects of all LHSs and RHSs must occur in left-to-right order.
                                      var lvals []lvalue
                                      for _, lhs := range lhss {
                                          var lval lvalue = blank{}
                                  Severity: Minor
                                  Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.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

                                  Method builder.builtin has 7 return statements (exceeds 4 allowed).
                                  Open

                                  func (b *builder) builtin(fn *Function, obj *types.Builtin, args []ast.Expr, typ types.Type, pos token.Pos) Value {
                                      switch obj.Name() {
                                      case "make":
                                          switch typ.Underlying().(type) {
                                          case *types.Slice:
                                  Severity: Major
                                  Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.go - About 45 mins to fix

                                    Method builder.addr has 6 return statements (exceeds 4 allowed).
                                    Open

                                    func (b *builder) addr(fn *Function, e ast.Expr, escaping bool) lvalue {
                                        switch e := e.(type) {
                                        case *ast.Ident:
                                            if isBlankIdent(e) {
                                                return blank{}
                                    Severity: Major
                                    Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.go - About 40 mins to fix

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

                                      func (b *builder) builtin(fn *Function, obj *types.Builtin, args []ast.Expr, typ types.Type, pos token.Pos) Value {
                                      Severity: Minor
                                      Found in go_agent/src/code.google.com/p/go.tools/ssa/builder.go - About 35 mins to fix

                                        There are no issues that match your filters.

                                        Category
                                        Status