cloudfoundry/dea_ng

View on GitHub

Showing 79 of 89 total issues

Method shutdown! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def shutdown!(goodbye_message)
    return if shutting_down?
    @shutting_down = true

    remove_droplets
Severity: Minor
Found in lib/dea/lifecycle/shutdown_handler.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 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 promise_start has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def promise_start
      Promise.new do |p|
        env = Env.new(StartMessage.new(@raw_attributes), self)

        if staged_info
Severity: Minor
Found in lib/dea/starting/instance.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 initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def initialize(message_bus, locator_responders, instance_registry, staging_registry, droplet_registry, directory_server, logger)
Severity: Major
Found in lib/dea/lifecycle/shutdown_handler.rb - About 50 mins to fix

    Method initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def initialize(bootstrap, message_bus, locator_responders, instance_registry, staging_task_registry, logger, config)
    Severity: Major
    Found in lib/dea/lifecycle/evacuation_handler.rb - About 50 mins to fix

      Method StreamHandler.ServeHTTP has 8 return statements (exceeds 4 allowed).
      Open

      func (handler *StreamHandler) ServeHTTP(writer http.ResponseWriter, r *http.Request) {
          var err error
      
          watcher, err := fsnotify.NewWatcher()
          if err != nil {
      Severity: Major
      Found in go/src/directoryserver/stream_handler.go - About 50 mins to fix

        Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def initialize(destination, key_file, cert_file, ca_file, timeout, custom_logger=nil)
        Severity: Minor
        Found in lib/dea/utils/hm9000.rb - About 45 mins to fix

          Method clone has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.clone(repository, destination)
                git_url, branch = parse(repository)
                target_dir = File.join(destination, File.basename(git_url.path, File.extname(git_url.path)))
          
                git_branch_option = branch.to_s.empty? ? "" : "-b #{branch}"
          Severity: Minor
          Found in buildpacks/lib/git.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 promise_health_check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def promise_health_check
                Promise.new do |p|
                  begin
                    logger.debug('droplet.health-check.get-container-info')
                    container.update_path_and_ip
          Severity: Minor
          Found in lib/dea/starting/instance.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 clean_uri has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.clean_uri(u)
              uri = u.is_a?(URI) ? u.dup : URI.parse(u)
              uri.password = nil if uri.password
              uri.user = nil if uri.user
              uri.to_s
          Severity: Minor
          Found in lib/dea/utils/uri_cleaner.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 handle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def handle(request)
                message = StagingMessage.new(request.data)
                message.set_responder do |params, &blk|
                  request.respond(params) { blk.call if blk }
                end
          Severity: Minor
          Found in lib/dea/responders/nats_staging.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 start has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def start(&callback)
                p = Promise.new do
                  logger.info('droplet.starting')
          
                  promise_state(State::BORN, State::STARTING).resolve
          Severity: Minor
          Found in lib/dea/starting/instance.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 link has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def link(&callback)
                Promise.resolve(promise_link) do |error, link_response|
                  if error
                    logger.warn('droplet.warden.link.failed', error: error, backtrace: error.backtrace)
          
          
          Severity: Minor
          Found in lib/dea/starting/instance.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 notify_completion has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def notify_completion(staging_message, task)
                task.after_complete_callback do |error|
                  data = {
                    task_id: task.task_id,
                    detected_buildpack: task.detected_buildpack,
          Severity: Minor
          Found in lib/dea/responders/staging.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 handle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def handle(request)
                  message = StagingMessage.new(request)
                  message.set_responder do |params, &blk|
                    @cc_client.send_staging_response(params) { blk.call if blk }
                  end
          Severity: Minor
          Found in lib/dea/responders/http_staging.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 transition_instances_to_evacuating has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def transition_instances_to_evacuating(first_time)
              @instance_registry.each do |instance|
                if instance.born? || instance.starting? || instance.resuming? || instance.running?
                  @logger.error("Found an unexpected #{instance.state} instance while evacuating") unless first_time
                  instance.state = Dea::Instance::State::EVACUATING
          Severity: Minor
          Found in lib/dea/lifecycle/evacuation_handler.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_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

          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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def initialize(bootstrap, dir_server, staging_message, buildpacks_in_use, custom_logger=nil)
          Severity: Minor
          Found in lib/dea/staging/staging_task.rb - About 35 mins to fix

            Method emit_container_metric has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def self.emit_container_metric(app_id, instanceIndex, cpuPercentage, memoryBytes, diskBytes)
            Severity: Minor
            Found in lib/dea/loggregator.rb - About 35 mins to fix
              Severity
              Category
              Status
              Source
              Language