cloudfoundry/cloud_controller_ng

View on GitHub

Showing 583 of 2,698 total issues

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

      def filter_by_org_guid(org_guids, plan_dataset, broker_dataset, omniscient, readable_orgs_query, readable_spaces_query, dataset)
Severity: Major
Found in app/fetchers/base_service_list_fetcher.rb - About 50 mins to fix

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

        def url(controller, path, page, page_size, order_direction, opts, request_params)
    Severity: Major
    Found in lib/cloud_controller/rest_controller/paginated_collection_renderer.rb - About 50 mins to fix

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

              def serialize_relationships(relationships, controller, depth, obj, opts, parents, orphans)
      Severity: Major
      Found in app/presenters/v2/relations_presenter.rb - About 50 mins to fix

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

              def filter_by_space_guid(space_guids, plan_dataset, broker_dataset, omniscient, readable_orgs_query, readable_spaces_query, dataset)
        Severity: Major
        Found in app/fetchers/base_service_list_fetcher.rb - About 50 mins to fix

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

                def self.record_continue(deployment, droplet, user_audit_info, v3_app_name, space_guid, org_guid)
          Severity: Minor
          Found in app/repositories/deployment_event_repository.rb - About 45 mins to fix

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

              def verify_ports
                @process.route_mappings.each do |mapping|
                  if mapping.app_port.blank?
                    return false unless @process.ports.include?(VCAP::CloudController::ProcessModel::DEFAULT_HTTP_PORT)
                  elsif mapping.has_app_port_specified? && @process.ports.exclude?(mapping.app_port)
            Severity: Minor
            Found in app/models/runtime/constraints/ports_policy.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 decorate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def decorate(hash, service_instances)
                  managed_service_instances = service_instances.select(&:managed_instance?)
                  return hash if managed_service_instances.empty?
            
                  hash[:included] ||= {}
            Severity: Minor
            Found in app/decorators/field_service_instance_plan_decorator.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 perform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def perform
                    not_found! unless service_instance
            
                    raise_if_other_operations_in_progress!
            
            
            Severity: Minor
            Found in app/jobs/v3/create_service_instance_job.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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def validate
                return if @process.ports.nil? || @process.ports.empty?
                return @errors.add('Process', 'must have at most 10 exposed ports.') if ports_limit_exceeded?
                return @errors.add('Ports', 'must be integers.') unless all_ports_are_integers?
                return @errors.add('Ports', 'must be in the 1024-65535 range.') unless all_ports_are_in_range?
            Severity: Minor
            Found in app/models/runtime/constraints/ports_policy.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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def validate
                return unless @quota_definition
                return unless @process.started?
                return if @quota_definition.app_instance_limit == -1 || @process.stopped?
            
            
            Severity: Minor
            Found in app/models/runtime/constraints/max_app_instances_policy.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 perform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def perform
                    not_found! unless service_instance
            
                    raise_if_other_operations_in_progress!
            
            
            Severity: Minor
            Found in app/jobs/v3/update_service_instance_job.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 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def initialize(process, health_check_timeout, health_check_invocation_timeout, health_check_type, health_check_http_endpoint, health_check_interval)
            Severity: Minor
            Found in app/models/runtime/constraints/base_health_check_policy.rb - About 45 mins to fix

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

                    def bind(binding, parameters: {}, accepts_incomplete: false)
                      client = VCAP::Services::ServiceClientProvider.provide(instance: binding.service_instance)
                      details = client.bind(
                        binding,
                        arbitrary_parameters: parameters,
              Severity: Minor
              Found in app/actions/v3/service_binding_create.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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validate
                    if buildpack_url.present? == admin_buildpack_name.present?
                      errors.add(:base, Sequel.lit('Must specify either a buildpack_url or an admin_buildpack_name'))
                    elsif admin_buildpack_name.present?
                      errors.add(:admin_buildpack_name, Sequel.lit("Specified unknown buildpack name: \"#{admin_buildpack_name}\"")) if Buildpack.find(name: admin_buildpack_name).nil?
              Severity: Minor
              Found in app/models/runtime/buildpack_lifecycle_buildpack_model.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 update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def update(service_plan, message, append_organizations: false)
                      type = message.type
                      requested_org_guids = message.organizations&.pluck(:guid) || []
              
                      unprocessable!("cannot update plans with visibility type 'space'") if space?(service_plan)
              Severity: Minor
              Found in app/actions/v3/service_plan_visibility_update.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 normalize_units has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def normalize_units(manifest_app_hash)
                      byte_measurement_key_words = %w[memory disk-quota disk_quota]
                      manifest_app_hash.each_with_index do |process_hash, index|
                        byte_measurement_key_words.each do |key|
                          value = process_hash[key]
              Severity: Minor
              Found in app/actions/space_diff_manifest.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 validate_buildpacks_are_ready has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validate_buildpacks_are_ready(app)
                    return unless app.buildpack_lifecycle_data
              
                    app.buildpack_lifecycle_data.buildpack_lifecycle_buildpacks.each do |blb|
                      next if blb.custom?
              Severity: Minor
              Found in app/actions/app_create.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(app:, user_audit_info:, create_revision: true, record_event: true)
                      app.db.transaction do
                        app.lock!
                        process_attributes = { state: ProcessModel::STARTED }
              
              
              Severity: Minor
              Found in app/actions/app_start.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 decorate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def decorate(hash, resources)
                    hash[:included] ||= {}
              
                    spaces = resources.map { |r| r.try(:space) || r }.uniq
                    orgs = spaces.map(&:organization).uniq
              Severity: Minor
              Found in app/decorators/field_service_instance_organization_decorator.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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def create(message:, shared_organizations: [])
                    domain = if message.requested?(:relationships)
                               PrivateDomain.new(
                                 name: message.name,
                                 owning_organization_guid: message.organization_guid
              Severity: Minor
              Found in app/actions/domain_create.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

              Severity
              Category
              Status
              Source
              Language