Showing 89 of 89 total issues
Method link
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def link(&callback)
Promise.resolve(promise_link) do |error, link_response|
if error
logger.warn('droplet.warden.link.failed', error: error, backtrace: error.backtrace)
- 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 initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(destination, key_file, cert_file, ca_file, timeout, custom_logger=nil)
Method transition_instances_to_evacuating
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def transition_instances_to_evacuating(first_time)
@instance_registry.each do |instance|
if instance.born? || instance.starting? || instance.resuming? || instance.running?
@logger.error("Found an unexpected #{instance.state} instance while evacuating") unless first_time
instance.state = Dea::Instance::State::EVACUATING
- 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 download_buildpacks
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def download_buildpacks
return unless config['staging'] && config['staging']['enabled']
buildpacks_url = URI::join(config['cc_url'], '/internal/buildpacks')
http = EM::HttpRequest.new(buildpacks_url, :connect_timeout => 5).get
- 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 emit_container_metric
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.emit_container_metric(app_id, instanceIndex, cpuPercentage, memoryBytes, diskBytes)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(nats, dea_id, resource_manager, config, url)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(bootstrap, dir_server, staging_message, buildpacks_in_use, custom_logger=nil)
Method run_script
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def run_script(name, script, privileged=false, discard_output=false, log_tag=nil)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(bootstrap, staging_task_registry, dir_server, resource_manager, config)
Method handle_http_response
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def handle_http_response(http, polling_destination, upload_callback)
if http.response_header.status < 300
response = JSON.parse(http.response)
case response.fetch("entity", {}).fetch("status", 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
Method check_state_file
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check_state_file
return unless File.exists?(path)
state = Yajl::Parser.parse(File.read(path))
if state && state["state"] == "RUNNING"
- 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 DeaClient.LookupPath
has 5 return statements (exceeds 4 allowed). Open
func (x *DeaClient) LookupPath(w http.ResponseWriter, r *http.Request) (string, error) {
y := fmt.Sprintf("http://%s:%d%s", x.Host, x.Port, r.URL.String())
log.Infof("Sending HTTP request to DEA: %s", y)
Method validate_arguments!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.validate_arguments!(*args)
source, dest, env = args
argfail!(args) unless source && dest && env
argfail!(args) unless File.directory?(File.expand_path(source))
argfail!(args) unless File.directory?(File.expand_path(dest))
- 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 fileSizeFormat
has 5 return statements (exceeds 4 allowed). Open
func fileSizeFormat(size int64) string {
if size >= (1 << 40) {
return fmt.Sprintf("%.1fT", float64(size)/(1<<40))
}
Method promise_exec_hook_script
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def promise_exec_hook_script(key)
Promise.new do |p|
if bootstrap.config['hooks'] && bootstrap.config['hooks'][key]
script_path = bootstrap.config['hooks'][key]
if File.exist?(script_path)
- 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_container
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_container(params)
[:bind_mounts, :limit_cpu, :byte, :inode, :limit_memory, :setup_inbound_network, :rootfs].each do |param|
raise ArgumentError, "expecting #{param.to_s} parameter to create container" if params[param].nil?
end
- 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 translate_attributes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.translate_attributes(attributes)
attributes = attributes.dup
transfer_attr_with_existance_check(attributes, 'instance_index', 'index')
transfer_attr_with_existance_check(attributes, 'application_version', 'version')
- 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 run_in_parallel_and_join
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run_in_parallel_and_join(*promises)
failure = nil
promises.each(&:run).each{ |p|
begin
p.resolve
- 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 resolve
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def resolve(promise)
f = Fiber.new do
result = nil
begin
- 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 promise_state
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def promise_state(from, to = nil)
Promise.new do |p|
if !Array(from).include?(state)
p.fail(TransitionError.new(state, to))
else
- 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"