lib/dea/starting/instance_registry.rb
Class InstanceRegistry
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class InstanceRegistry
DEFAULT_CRASH_LIFETIME_SECS = 60 * 60
CRASHES_REAPER_INTERVAL_SECS = 10
DEFAULT_STOPPING_LIFETIME_SECS = 60
Method instances_filtered_by_message
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
def instances_filtered_by_message(message)
app_id = message.data["droplet"].to_s
logger.debug2("Filter message for app_id: %s" % app_id, app_id: app_id)
- 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_stopping
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def reap_stopping
logger.debug2("Reaping stopping")
stopping_by_app = Hash.new { |h, k| h[k] = [] }
select(&:stopping?).each { |i| stopping_by_app[i.application_id] << i }
- 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"