Showing 79 of 89 total issues
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(bootstrap, staging_task_registry, dir_server, resource_manager, config)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(nats, dea_id, resource_manager, config, url)
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 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
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 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)
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 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 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 promise_read_instance_manifest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def promise_read_instance_manifest(container_path)
Promise.new do |p|
if container_path.nil?
p.deliver({})
next
- 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_destroy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def promise_destroy
Promise.new do |promise|
if container.handle.nil?
logger.error("task.destroy.invalid")
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"
Further reading
Method destroy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def destroy(&callback)
if !droplet_dirname.include?('.deleted.')
# Rename first to both prevent a new instance from referencing a file
# that is about to be deleted and to avoid doing a potentially expensive
# operation on the reactor thread.
- 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 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"
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 reap_orphaned_containers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def reap_orphaned_containers
logger.debug("Reaping orphaned containers")
promise_handles = Dea::Promise.new do |p|
p.deliver warden_container_lister.list.handles
- 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 verify_ssl_certs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def verify_ssl_certs
ssl = @config['ssl']
if ssl
missing_files = []
- 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"