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>")
- Read upRead up
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
File client.rb
has 397 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'ruby_vim_sdk'
module VSphereCloud
class Client
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)
- Read upRead up
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;
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
- Read upRead up
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:
//
- Read upRead up
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
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
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().
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
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
- Read upRead up
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
- Read upRead up
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
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?
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
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:
- Read upRead up
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.)
- Read upRead up
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}"
- Read upRead up
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 {