cloudfoundry/dea_ng

View on GitHub
lib/dea/bootstrap.rb

Summary

Maintainability
D
2 days
Test Coverage

Class Bootstrap has 47 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Bootstrap
    DEFAULT_HEARTBEAT_INTERVAL = 10 # In secs
    DEFAULT_METRICS_INTERVAL = 30
    DROPLET_REAPER_INTERVAL_SECS = 60
    CONTAINER_REAPER_INTERVAL_SECS = 600
Severity: Minor
Found in lib/dea/bootstrap.rb - About 6 hrs to fix

    File bootstrap.rb has 428 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "set"
    
    require "steno"
    require "steno/config"
    require "steno/core_ext"
    Severity: Minor
    Found in lib/dea/bootstrap.rb - About 6 hrs to fix

      Method handle_dea_stop has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def handle_dea_stop(message)
            if message.data.size == 1 && message.data['droplet']
              staging_stop_msg = Dea::Nats::Message.new(
                message.nats,
                'staging.stop',
      Severity: Minor
      Found in lib/dea/bootstrap.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 handle_dea_update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def handle_dea_update(message)
            app_id = message.data["droplet"].to_s
            uris = message.data["uris"]
            app_version = message.data["version"]
      
      
      Severity: Minor
      Found in lib/dea/bootstrap.rb - About 55 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

      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
      Severity: Minor
      Found in lib/dea/bootstrap.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

      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
      Severity: Minor
      Found in lib/dea/bootstrap.rb - About 25 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