cloudfoundry/cloud_controller_ng

View on GitHub

Showing 583 of 2,698 total issues

Avoid too many return statements within this method.
Open

      return MetadataError.error("'#{name}' contains invalid characters") unless valid_characters?(name)
Severity: Major
Found in app/messages/metadata_validator_helper.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

          return MetadataError.error("'#{name}' starts or ends with invalid characters") unless start_end_alphanumeric?(name)
    Severity: Major
    Found in app/messages/metadata_validator_helper.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return false unless port_list.all? { |p| port_in_valid_range?(p.to_i) }
      Severity: Major
      Found in lib/cloud_controller/transport_rule_validator.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return true if ipv4s.first == sorted_ipv4s.first
        Severity: Major
        Found in lib/cloud_controller/rule_validator.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return false unless port_list.all? { |p| /\A\s*\d+\s*\z/.match(p) }
          Severity: Major
          Found in lib/cloud_controller/transport_rule_validator.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return true
            Severity: Major
            Found in lib/cloud_controller/transport_rule_validator.rb - About 30 mins to fix

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

                    def send_unbind_to_client(binding)
                      client = VCAP::Services::ServiceClientProvider.provide(instance: binding.service_instance)
                      details = client.unbind(
                        binding,
                        accepts_incomplete: true,
              Severity: Minor
              Found in app/actions/v3/service_binding_delete.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 decorate has a Cognitive Complexity of 6 (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?
              
                    brokers = ServiceBroker.
              Severity: Minor
              Found in app/decorators/field_service_instance_broker_decorator.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 validate_total_reserved_route_ports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validate_total_reserved_route_ports
                    return unless total_reserved_route_ports
              
                    err_msg = Sequel.lit('Total reserved ports must be -1, 0, or a positive integer, and must be less than or equal to total routes.')
                    route_ports_out_of_range = total_reserved_route_ports < UNLIMITED
              Severity: Minor
              Found in app/models/runtime/quota_definition.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 validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def validate
                  return unless @process.docker_image
              
                  @errors.add(:docker_image, BUILDPACK_DETECTED_ERROR_MSG) if @process.buildpack_specified?
              
              
              Severity: Minor
              Found in app/models/runtime/constraints/docker_policy.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def create(message:, user_audit_info:, record_event: true)
                      Steno.logger('cc.action.package_create').info("creating package type #{message.type} for app #{message.app_guid}")
              
                      package              = PackageModel.new
                      package.app_guid     = message.app_guid
              Severity: Minor
              Found in app/actions/package_create.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 validate_quotas! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validate_quotas!(errors)
                    quota_errors = errors.on(:quota).to_a
                    plan_errors = errors.on(:service_plan).to_a
              
                    code = if quota_errors.include?(:service_instance_space_quota_exceeded)
              Severity: Minor
              Found in app/actions/mixins/service_instance_create.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 delete_service_instances has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def delete_service_instances(space_model)
                    space_model.service_instances_dataset.each_with_object([]) do |service_instance, errors|
                      service_instance_deleter = V3::ServiceInstanceDelete.new(service_instance, @services_event_repository)
                      result = service_instance_deleter.delete
                      unless result[:finished]
              Severity: Minor
              Found in app/actions/space_delete.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 find_buildpack_to_update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                      def find_buildpack_to_update(found_buildpacks, detected_stack, planned_jobs)
                        return if found_buildpacks.empty?
              
                        ensure_no_buildpack_downgraded_to_nil_stack!(found_buildpacks)
              
              
              Severity: Minor
              Found in app/jobs/runtime/buildpack_installer_factory.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 perform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                      def perform
                        service_instance = ManagedServiceInstance.first(guid: service_instance_guid)
                        return if service_instance.nil?
              
                        intended_operation = service_instance.last_operation
              Severity: Minor
              Found in app/jobs/v2/services/service_instance_state_fetch.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 where has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def where(*cond)
                    return super if block_given?
              
                    filters_per_role = cache_get(:filters_per_role) || init_filters([])
              
              
              Severity: Minor
              Found in app/models/runtime/role.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 raise_if_invalid_update! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def raise_if_invalid_update!
                      return unless message.updates.any?
              
                      service_instance.set(message.updates)
                      return service_instance.reload if service_instance.valid?
              Severity: Minor
              Found in app/actions/v3/service_instance_update_managed.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 update_app_revision has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def update_app_revision(app, user_audit_info)
                      return nil unless app.revisions_enabled && app.droplet_guid.present?
              
                      latest_revision = app.latest_revision
                      if latest_revision.nil?
              Severity: Minor
              Found in app/actions/revision_resolver.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 validate_key! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def validate_key!(key, message_name)
                      return unless key
              
                      key_already_exists!(message_name) if key.create_succeeded? || key.create_in_progress?
                      key_incomplete_deletion!(message_name) if key.delete_failed? || key.delete_in_progress?
              Severity: Minor
              Found in app/actions/service_credential_binding_key_create.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_space_role has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def create_space_role(type:, user:, space:)
                    error!("Users cannot be assigned roles in a space if they do not have a role in that space's organization.") unless space.in_organization?(user)
              
                    UsernamePopulator.new(uaa_username_lookup_client).transform(user)
              
              
              Severity: Minor
              Found in app/actions/role_create.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