cloudfoundry-community/bosh-cloudstack-cpi

View on GitHub

Showing 1,157 of 1,705 total issues

Function WriteType has a Cognitive Complexity of 52 (exceeds 20 allowed). Consider refactoring.
Open

func WriteType(buf *bytes.Buffer, this *Package, typ Type) {
    switch t := typ.(type) {
    case nil:
        buf.WriteString("<nil>")

Severity: Minor
Found in go_agent/src/code.google.com/p/go.tools/go/types/typestring.go - About 5 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 cloud.rb has 399 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'cloud/aws/stemcell_finder'

module Bosh::AwsCloud

  class Cloud < Bosh::Cloud
Severity: Minor
Found in bosh_aws_cpi/lib/cloud/aws/cloud.rb - About 5 hrs to fix

    File client.rb has 397 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'ruby_vim_sdk'
    
    module VSphereCloud
    
      class Client
    Severity: Minor
    Found in bosh_vsphere_cpi/lib/cloud/vsphere/client.rb - About 5 hrs to fix

      Function checkBuildTag has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring.
      Open

      func checkBuildTag(name string, data []byte) {
          if !vet("buildtags") {
              return
          }
          lines := bytes.SplitAfter(data, nl)
      Severity: Minor
      Found in go_agent/src/code.google.com/p/go.tools/cmd/vet/buildtag.go - About 5 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

      Class Cloud has 40 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Cloud < Bosh::Cloud
          include VimSdk
          include RetryBlock
      
          class TimeoutException < StandardError;
      Severity: Minor
      Found in bosh_vsphere_cpi/lib/cloud/vsphere/cloud.rb - About 5 hrs to fix

        Function visitInstr has a Cognitive Complexity of 50 (exceeds 20 allowed). Consider refactoring.
        Open

        func visitInstr(fr *frame, instr ssa.Instruction) continuation {
            switch instr := instr.(type) {
            case *ssa.DebugRef:
                // no-op
        
        
        Severity: Minor
        Found in go_agent/src/code.google.com/p/go.tools/ssa/interp/interp.go - About 5 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 lift has a Cognitive Complexity of 50 (exceeds 20 allowed). Consider refactoring.
        Open

        func lift(fn *Function) {
            // TODO(adonovan): opt: lots of little optimizations may be
            // worthwhile here, especially if they cause us to avoid
            // buildDomTree.  For example:
            //
        Severity: Minor
        Found in go_agent/src/code.google.com/p/go.tools/ssa/lift.go - About 5 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

          linux has 38 methods (exceeds 20 allowed). Consider refactoring.
          Open

          type linux struct {
              fs                 boshsys.FileSystem
              cmdRunner          boshsys.CmdRunner
              collector          boshstats.StatsCollector
              compressor         boshcmd.Compressor
          Severity: Minor
          Found in go_agent/src/bosh/platform/linux_platform.go - About 5 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 perform_validation has 124 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def perform_validation(options = {})
                    # CLEANUP this syntax
                    allow_sparse = options.has_key?(:allow_sparse) ?
                        !!options[:allow_sparse] :
                        false
              Severity: Major
              Found in bosh_cli/lib/cli/release_tarball.rb - 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 deadState.findDead has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring.
                Open

                func (d *deadState) findDead(stmt ast.Stmt) {
                    // Is this a labeled goto target?
                    // If so, assume it is reachable due to the goto.
                    // This is slightly conservative, in that we don't
                    // check that the goto is reachable, so
                Severity: Minor
                Found in go_agent/src/code.google.com/p/go.tools/cmd/vet/deadcode.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

                Class Monit has 37 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class Monit
                    BUFSIZE = (32 * 1024)
                    NUM_RETRY_MONIT_INCARNATION = 60
                    NUM_RETRY_MONIT_WAIT_INCARNATION = 15
                
                
                Severity: Minor
                Found in bosh_agent/lib/bosh_agent/monit.rb - About 4 hrs to fix

                  Method serialize has 120 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def serialize(value, info, default_namespace = @default_namespace)
                          return unless VmomiSupport.is_child_version(@version, info.version)
                  
                          if value.nil?
                            return if info.optional?
                  Severity: Major
                  Found in bosh_vsphere_cpi/lib/ruby_vim_sdk/soap/serializer.rb - About 4 hrs to fix

                    File update_release.rb has 365 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require 'common/version/release_version'
                    
                    module Bosh::Director
                      module Jobs
                        class UpdateRelease < BaseJob
                    Severity: Minor
                    Found in bosh-director/lib/bosh/director/jobs/update_release.rb - About 4 hrs to fix

                      Method sanity.checkInstr has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func (s *sanity) checkInstr(idx int, instr Instruction) {
                          switch instr := instr.(type) {
                          case *If, *Jump, *Return, *Panic:
                              s.errorf("control flow instruction not at end of block")
                          case *Phi:
                      Severity: Minor
                      Found in go_agent/src/code.google.com/p/go.tools/ssa/sanity.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

                      Function WriteExpr has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func WriteExpr(buf *bytes.Buffer, x ast.Expr) {
                          // The AST preserves source-level parentheses so there is
                          // no need to introduce them here to correct for different
                          // operator precedences. (This assumes that the AST was
                          // generated by a Go parser.)
                      Severity: Minor
                      Found in go_agent/src/code.google.com/p/go.tools/go/types/exprstring.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 create_vm has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def create_vm(agent_id, stemcell_id, resource_pool,
                                        network_spec = nil, disk_locality = nil, environment = nil)
                            with_thread_name("create_vm(#{agent_id}, ...)") do
                              @logger.info('Creating new server...')
                              server_name = "vm-#{generate_unique_name}"
                      Severity: Minor
                      Found in bosh_openstack_cpi/lib/cloud/openstack/cloud.rb - 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
                        Severity
                        Category
                        Status
                        Source
                        Language