cloudfoundry/cloud_controller_ng

View on GitHub

Showing 583 of 2,698 total issues

Method create has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def create(message, lifecycle)
      app = nil
      AppModel.db.transaction do
        app = AppModel.create(
          name: message.name,
Severity: Minor
Found in app/actions/app_create.rb - About 1 hr to fix

    Method render_json has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def render_json(controller, obj, opts)
          inline_relations_depth = opts[:inline_relations_depth] || @default_inline_relations_depth
          if inline_relations_depth > @max_inline_relations_depth
            raise CloudController::Errors::ApiError.new_from_details('BadQueryParameter',
                                                                     "inline_relations_depth must be <= #{@max_inline_relations_depth}")
    Severity: Minor
    Found in lib/cloud_controller/rest_controller/object_renderer.rb - About 1 hr to fix

      Method start_cc has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def start_cc(opts={})
          @cc_pids ||= []
      
          config_file = opts[:config] || 'config/cloud_controller.yml'
          config = VCAP::CloudController::YAMLConfig.safe_load_file(config_file)
      Severity: Minor
      Found in spec/support/integration/setup.rb - About 1 hr to fix

        Method create_route_binding_request has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def create_route_binding_request(route_guid, service_instance_guid)
            {
              metadata: {
                annotations: {
                  foo: 'bar'
        Severity: Minor
        Found in spec/request/lifecycle/service_route_bindings_synoptic_spec.rb - About 1 hr to fix

          Method record_create has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def self.record_create(deployment, droplet, user_audit_info, v3_app_name, space_guid, org_guid, params, type)
          Severity: Major
          Found in app/repositories/deployment_event_repository.rb - About 1 hr to fix

            Method serialize_to_one_relationship has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    def serialize_to_one_relationship(response, associated_model_instance, associated_controller, relationship_name, depth, opts, parents, orphans)
            Severity: Major
            Found in app/presenters/v2/relations_presenter.rb - About 1 hr to fix

              Method serialize_to_many_relationship has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      def serialize_to_many_relationship(response, associated_model_instances, associated_controller, relationship_name, depth, opts, parents, orphans)
              Severity: Major
              Found in app/presenters/v2/relations_presenter.rb - About 1 hr to fix

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

                      def create(app:, user_audit_info:, message:)
                        deployment = nil
                
                        DeploymentModel.db.transaction do
                          app.lock!
                Severity: Minor
                Found in app/actions/deployment_create.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 validate_service_instance! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                      def validate_service_instance!(service_instance)
                        if service_instance.managed_instance?
                          service_not_bindable! unless service_instance.service_plan.bindable?
                          service_instance_not_found! if service_instance.create_failed?
                          operation_in_progress! if service_instance.operation_in_progress?
                Severity: Minor
                Found in app/actions/service_credential_binding_key_create.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 create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def create(app, args)
                      type = args[:type]
                      attrs = args.merge({
                                           diego: true,
                                           instances: default_instance_count(type),
                Severity: Minor
                Found in app/actions/process_create.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 perform has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                        def perform
                          droplet = DropletModel.find(guid: @droplet_guid)
                
                          if droplet
                            sha1_digest = Digester.new.digest_path(@local_path)
                Severity: Minor
                Found in app/jobs/v3/droplet_upload.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 perform has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                        def perform
                          logger = Steno.logger('cc.background')
                          logger.info("Copying the package bits from package '#{@src_package_guid}' to package '#{@dest_package_guid}'")
                
                          dest_package = VCAP::CloudController::PackageModel.find(guid: @dest_package_guid)
                Severity: Minor
                Found in app/jobs/v3/package_bits_copier.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 perform has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                      def perform
                        logger = Steno.logger('cc.background')
                        logger.info("Applying app manifest to app: #{resource_guid}")
                
                        app_guid_message_hash.each do |app_guid, message|
                Severity: Minor
                Found in app/jobs/space_apply_manifest_action_job.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 adapt_boolean_expression has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def adapt_boolean_expression(expression)
                      args = expression.args.map do |arg|
                        case arg
                        when Sequel::SQL::BooleanExpression
                          adapt_boolean_expression(arg)
                Severity: Minor
                Found in app/models/runtime/role.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 delete has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                      def delete(binding)
                        operation_in_progress! if blocking_operation_in_progress?(binding)
                
                        result = send_unbind_to_client(binding)
                        if result[:finished]
                Severity: Minor
                Found in app/actions/v3/service_binding_delete.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 call has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                      def call(env)
                        return call_app(env) unless env['HTTP_ORIGIN']
                        return call_app(env) unless @allowed_cors_domains.any? { |d| d =~ env['HTTP_ORIGIN'] }
                
                        cors_headers = {
                Severity: Minor
                Found in middleware/cors.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 destroy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def destroy
                    service_plan = ServicePlanFetcher.fetch(hashed_params[:guid])
                    service_plan_not_found! unless service_plan.present? && visible_to_current_user?(plan: service_plan)
                    unauthorized! unless current_user_can_write?(service_plan)
                    unprocessable!('Cannot delete visibilities from non-org-restricted plans') unless service_plan.visibility_type == ServicePlanVisibilityTypes::ORGANIZATION
                Severity: Minor
                Found in app/controllers/v3/service_plan_visibility_controller.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 delete has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def delete(service_bindings)
                      bindings_to_delete = Array(service_bindings)
                
                      warnings_accumulator = []
                      errors = each_with_error_aggregation(bindings_to_delete) do |service_binding|
                Severity: Minor
                Found in app/actions/v2/services/service_binding_delete.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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def initialize(params={})
                      super
                      params = params.deep_symbolize_keys
                      @requested_keys << :health_check_type if HashUtils.dig(params, :health_check)&.key?(:type)
                      @requested_keys << :health_check_timeout if HashUtils.dig(params, :health_check, :data)&.key?(:timeout)
                Severity: Minor
                Found in app/messages/process_update_message.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 send_or_redirect_blob has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def send_or_redirect_blob(blob)
                      raise CloudController::Errors::BlobNotFound unless blob
                
                      if @blobstore.local?
                        blob_sender.send_blob(blob, @controller)
                Severity: Minor
                Found in app/controllers/runtime/helpers/blob_dispatcher.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

                Severity
                Category
                Status
                Source
                Language