cloudfoundry/dea_ng

View on GitHub
lib/dea/starting/instance_registry.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Class InstanceRegistry has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

  class InstanceRegistry
    DEFAULT_CRASH_LIFETIME_SECS  = 60 * 60
    CRASHES_REAPER_INTERVAL_SECS = 10
    DEFAULT_STOPPING_LIFETIME_SECS = 60

Severity: Minor
Found in lib/dea/starting/instance_registry.rb - About 2 hrs to fix

    Method instances_filtered_by_message has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    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)
    
    
    Severity: Minor
    Found in lib/dea/starting/instance_registry.rb - About 1 hr to fix

    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

        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 }
    Severity: Minor
    Found in lib/dea/starting/instance_registry.rb - About 45 mins to fix

    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

    There are no issues that match your filters.

    Category
    Status