Showing 9 of 9 total issues
Class App
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Marathon::App < Marathon::Base
ACCESSORS = %w[ id args cmd cpus disk env executor fetch instances mem ports requirePorts
storeUris tasksHealthy tasksUnhealthy tasksRunning tasksStaged upgradeStrategy
deployments uris user version labels ]
Method remove_keys
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def remove_keys(hash, keys)
if hash.is_a?(Hash)
new_hash = {}
hash.each { |k, v| new_hash[k] = remove_keys(v, keys) unless keys.include?(k) }
new_hash
- 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 keywordize_hash!
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def keywordize_hash!(hash, ignore_keys = [:env])
if hash.is_a?(Hash)
hmap!(hash) do |k, v|
key = k.to_sym
if ignore_keys.include?(key) and v.is_a?(Hash)
- 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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(hash)
super(Marathon::Util.merge_keywordized_hash(DEFAULTS, hash), ACCESSORS)
Marathon::Util.validate_choice('protocol', protocol, %w[tcp udp])
raise Marathon::Error::ArgumentError, 'containerPort must not be nil' unless containerPort
raise Marathon::Error::ArgumentError, 'containerPort must be a non negative number' \
- 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 validate_choice
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_choice(name, value, allowed, nil_allowed = true)
value = value[name] if value.is_a?(Hash)
if value.nil?
unless nil_allowed
raise Marathon::Error::ArgumentError, "#{name} must not be 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 add_choice
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_choice(opts, name, value, allowed, nil_allowed = true)
Method to_s
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def to_s
if protocol == 'COMMAND'
"Marathon::HealthCheck { :protocol => #{protocol} :command => #{command} }"
elsif %w[HTTP HTTPS MESOS_HTTP MESOS_HTTPS].include? protocol
"Marathon::HealthCheck { :protocol => #{protocol} :portIndex => #{portIndex} :path => #{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 initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(hash, attr_accessors = [])
raise ArgumentError, 'hash must be a Hash' if attr_accessors and attr_accessors.size > 0 and not hash.is_a?(Hash)
raise ArgumentError, 'hash must be Hash or Array' unless hash.is_a?(Hash) or hash.is_a?(Array)
raise ArgumentError, 'attr_accessors must be an Array' unless attr_accessors.is_a?(Array)
@info = Marathon::Util.keywordize_hash!(hash)
- 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 error_message
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def error_message(response)
body = response.parsed_response
if not body.is_a?(Hash)
body
elsif body['message']
- 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"