cloudfoundry/cloud_controller_ng

View on GitHub

Showing 570 of 2,676 total issues

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 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 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 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 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 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 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 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 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 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

    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 check_utf8_encoding! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def check_utf8_encoding!(yaml_data)
        if yaml_data.is_a?(Hash)
          yaml_data.each_value do |value|
            check_utf8_encoding!(value)
          end
    Severity: Minor
    Found in app/controllers/v3/application_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 show has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def show
        service_broker = VCAP::CloudController::ServiceBroker.find(guid: hashed_params[:guid])
        broker_not_found! unless service_broker
    
        if service_broker.space_guid
    Severity: Minor
    Found in app/controllers/v3/service_brokers_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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(params={})
          super(params)
          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 droplet_buildpack_info has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

            def droplet_buildpack_info
              return nil if droplet.docker?
              return nil unless droplet.lifecycle_data&.buildpack_lifecycle_buildpacks
    
              droplet.lifecycle_data.buildpack_lifecycle_buildpacks.map do |buildpack|
    Severity: Minor
    Found in app/presenters/v3/droplet_presenter.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 mode_validator has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def mode_validator(mode)
          return if mode.nil?
    
          unless mode.is_a?(String)
            errors.add(:resources, "#{RESOURCE_ERROR_PREAMBLE} a non-string mode") unless errors.added?(
    Severity: Minor
    Found in app/messages/resource_match_create_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 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 upload_buildpack has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def upload_buildpack(buildpack, bits_file_path, new_filename)
          return false if buildpack.locked
    
          sha256 = Digester.new(algorithm: OpenSSL::Digest::SHA256).digest_path(bits_file_path)
          new_key = "#{buildpack.guid}_#{sha256}"
    Severity: Minor
    Found in lib/cloud_controller/upload_buildpack.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 filter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def filter(message, dataset)
            dataset = dataset.where(name: message.names) if message.requested?(:names)
    
            dataset = dataset.where(space_guid: message.space_guids) if message.requested?(:space_guids)
    
    
    Severity: Minor
    Found in app/fetchers/app_list_fetcher.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 valid? has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def valid?
          return @valid if defined? @valid
    
          if @create_data
            validate_hash!(:create, @create_data)
    Severity: Minor
    Found in lib/services/service_brokers/v2/service_instance_schema.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