cloudfoundry/dea_ng

View on GitHub

Showing 79 of 89 total issues

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

    def initialize(bootstrap, staging_task_registry, dir_server, resource_manager, config)
Severity: Minor
Found in lib/dea/responders/staging.rb - About 35 mins to fix

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

        def initialize(nats, dea_id, resource_manager, config, url)
    Severity: Minor
    Found in lib/dea/responders/dea_locator.rb - About 35 mins to fix

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

        def run_script(name, script, privileged=false, discard_output=false, log_tag=nil)
      Severity: Minor
      Found in lib/container/container.rb - About 35 mins to fix

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

            def self.validate_arguments!(*args)
              source, dest, env = args
              argfail!(args) unless source && dest && env
              argfail!(args) unless File.directory?(File.expand_path(source))
              argfail!(args) unless File.directory?(File.expand_path(dest))
        Severity: Minor
        Found in buildpacks/lib/buildpack.rb - About 35 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_http_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def handle_http_response(http, polling_destination, upload_callback)
            if http.response_header.status < 300
              response = JSON.parse(http.response)
        
              case response.fetch("entity", {}).fetch("status", nil)
        Severity: Minor
        Found in lib/dea/utils/upload.rb - About 35 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 DeaClient.LookupPath has 5 return statements (exceeds 4 allowed).
        Open

        func (x *DeaClient) LookupPath(w http.ResponseWriter, r *http.Request) (string, error) {
            y := fmt.Sprintf("http://%s:%d%s", x.Host, x.Port, r.URL.String())
        
            log.Infof("Sending HTTP request to DEA: %s", y)
        
        
        Severity: Major
        Found in go/src/directoryserver/deaclient.go - About 35 mins to fix

          Function fileSizeFormat has 5 return statements (exceeds 4 allowed).
          Open

          func fileSizeFormat(size int64) string {
              if size >= (1 << 40) {
                  return fmt.Sprintf("%.1fT", float64(size)/(1<<40))
              }
          
          
          Severity: Major
          Found in go/src/directoryserver/directoryserver.go - About 35 mins to fix

            Method check_state_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def check_state_file
                    return unless File.exists?(path)
            
                    state = Yajl::Parser.parse(File.read(path))
                    if state && state["state"] == "RUNNING"
            Severity: Minor
            Found in lib/dea/health_check/state_file_ready.rb - About 35 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_exec_hook_script has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def promise_exec_hook_script(key)
                  Promise.new do |p|
                    if bootstrap.config['hooks'] && bootstrap.config['hooks'][key]
                      script_path = bootstrap.config['hooks'][key]
                      if File.exist?(script_path)
            Severity: Minor
            Found in lib/dea/starting/instance.rb - About 35 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_read_instance_manifest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def promise_read_instance_manifest(container_path)
                  Promise.new do |p|
                    if container_path.nil?
                      p.deliver({})
                      next
            Severity: Minor
            Found in lib/dea/starting/instance.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

            Method resolve has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def resolve(promise)
                    f = Fiber.new do
                      result = nil
            
                      begin
            Severity: Minor
            Found in lib/dea/promise.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

            Method promise_destroy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def promise_destroy
                  Promise.new do |promise|
                    if container.handle.nil?
                      logger.error("task.destroy.invalid")
                    else
            Severity: Minor
            Found in lib/dea/task.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

            Method destroy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def destroy(&callback)
                  if !droplet_dirname.include?('.deleted.')
                    # Rename first to both prevent a new instance from referencing a file
                    # that is about to be deleted and to avoid doing a potentially expensive
                    # operation on the reactor thread.
            Severity: Minor
            Found in lib/dea/droplet.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

            Method run_in_parallel_and_join has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def run_in_parallel_and_join(*promises)
                    failure = nil
                    promises.each(&:run).each{ |p|
                      begin
                        p.resolve
            Severity: Minor
            Found in lib/dea/promise.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

            Method promise_state has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def promise_state(from, to = nil)
                  Promise.new do |p|
                    if !Array(from).include?(state)
                      p.fail(TransitionError.new(state, to))
                    else
            Severity: Minor
            Found in lib/dea/starting/instance.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

            Method translate_attributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.translate_attributes(attributes)
                  attributes = attributes.dup
            
                  transfer_attr_with_existance_check(attributes, 'instance_index', 'index')
                  transfer_attr_with_existance_check(attributes, 'application_version', 'version')
            Severity: Minor
            Found in lib/dea/starting/instance.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

            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

            Method create_container has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def create_container(params)
                [:bind_mounts, :limit_cpu, :byte, :inode, :limit_memory, :setup_inbound_network, :rootfs].each do |param|
                  raise ArgumentError, "expecting #{param.to_s} parameter to create container" if params[param].nil?
                end
            
            
            Severity: Minor
            Found in lib/container/container.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

            Method verify_ssl_certs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def verify_ssl_certs
                  ssl = @config['ssl']
            
                  if ssl
                    missing_files = []
            Severity: Minor
            Found in lib/dea/config.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

            Severity
            Category
            Status
            Source
            Language