cloudfoundry/cloud_controller_ng

View on GitHub

Showing 570 of 2,679 total issues

Method build_usage_event_json has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def build_usage_event_json(service_usage_event)
    {
      'guid' => service_usage_event.guid,
      'created_at' => iso8601,
      'updated_at' => iso8601,
Severity: Minor
Found in spec/request/service_usage_events_spec.rb - About 1 hr to fix

    Method generate_org_quota_single_response has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def generate_org_quota_single_response(list_of_orgs)
      {
        guid: organization_quota.guid,
        created_at: iso8601,
        updated_at: iso8601,
    Severity: Minor
    Found in spec/request/organization_quotas_spec.rb - About 1 hr to fix

      Method to_hash has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def to_hash
                metadata = broker_metadata
      
                hash = {
                  guid: service_offering.guid,
      Severity: Minor
      Found in app/presenters/v3/service_offering_presenter.rb - About 1 hr to fix

        Method restage has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def restage(guid)
              process = find_guid_and_validate_access(:read_for_update, guid)
        
              validate_process!(process)
        
        
        Severity: Minor
        Found in app/controllers/runtime/restages_controller.rb - About 1 hr to fix

          Method modify_transaction has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def modify_transaction(changeset)
                return if changeset.empty?
          
                uri          = URI("#{uaa_target}/oauth/clients/tx/modify")
                request_body = batch_request(changeset)
          Severity: Minor
          Found in lib/services/sso/uaa/uaa_client_manager.rb - About 1 hr to fix

            Method can_be_decorated_with_include_binding_service_instance_decorator has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def self.can_be_decorated_with_include_binding_service_instance_decorator(klazz)
                  RSpec.describe IncludeBindingServiceInstanceDecorator do
                    subject(:decorator) { described_class }
                    let(:bindings) { Array.new(3) { klazz.make } }
                    let(:instances) do

              Method find_or_create_valid_route has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                    def find_or_create_valid_route(app, manifest_route, user_audit_info)
                      manifest_route[:candidate_host_domain_pairs].each do |candidate|
                        potential_domain = candidate[:domain]
                        existing_domain = Domain.find(name: potential_domain)
                        next unless existing_domain
              Severity: Minor
              Found in app/actions/manifest_route_update.rb - About 1 hr 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 buildpacks_content has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def buildpacks_content
                    return unless buildpacks.is_a?(Array)
              
                    non_string = length_error = false
              
              
              Severity: Minor
              Found in app/messages/buildpack_lifecycle_data_message.rb - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def update
                  message = SpaceFeatureUpdateMessage.new(hashed_params[:body])
                  unprocessable!(message.errors.full_messages) unless message.valid?
              
                  space = SpaceFetcher.new.fetch(hashed_params[:guid])
              Severity: Minor
              Found in app/controllers/v3/space_features_controller.rb - About 1 hr 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_visibility has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def update_visibility(opts={})
                  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)
              
              
              Severity: Minor
              Found in app/controllers/v3/service_plan_visibility_controller.rb - About 1 hr 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 has_valid_hash_keys has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def has_valid_hash_keys(service)
                    valid_service_binding_keys = %i[name parameters binding_name]
                    return false unless service.is_a?(Hash)
                    return false unless service.length <= valid_service_binding_keys.length && service.keys.all? { |key| valid_service_binding_keys.include?(key) }
                    return false unless service.key?(:name)
              Severity: Minor
              Found in app/messages/manifest_service_binding_create_message.rb - About 1 hr 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 index has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def index
                  message = ProcessesListMessage.from_params(subresource_query_params)
                  invalid_param!(message.errors.full_messages) unless message.valid?
              
                  if app_nested?
              Severity: Minor
              Found in app/controllers/v3/processes_controller.rb - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
              Open

                    def filter(message, app, space_guids, dataset)
                      if message.requested?(:current) && app
                        dataset = dataset.extension(:null_dataset)
                        return dataset.nullify unless app.droplet
              
              
              Severity: Minor
              Found in app/fetchers/droplet_list_fetcher.rb - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def start
                    raise Error.new('Cannot start more than once') if @thread
              
                    @thread = Thread.new do
                      failed = false
              Severity: Minor
              Found in lib/locket/lock_runner.rb - About 1 hr 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_workpool_thread has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def create_workpool_thread
                  Thread.new do
                    catch(:exit) do
                      loop do
                        job, args = @queue.pop
              Severity: Minor
              Found in lib/utils/workpool.rb - About 1 hr 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 to_hash has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def to_hash(opts={})
                    hash = {}
                    redact_vals = opts[:redact]
                    attrs = opts[:attrs] || export_attrs
              
              
              Severity: Minor
              Found in lib/sequel_plugins/vcap_serialization.rb - About 1 hr 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 sort_list has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def sort_list(list, order_by_method, order_direction)
                    sorted_list = list.sort do |object1, object2|
                      value1 = object1.public_send(order_by_method)
                      value2 = object2.public_send(order_by_method)
                      next 0 if value1.nil? && value2.nil?
              Severity: Minor
              Found in lib/cloud_controller/paging/list_paginator.rb - About 1 hr 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 object_eq has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def object_eq(actual, expected, path=[])
                  @error_message ||= []
              
                  types = [actual, expected].map(&:class).uniq
              
              
              Severity: Minor
              Found in spec/support/matchers/match_object.rb - About 1 hr 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 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def create(app, message, user_audit_info, droplet: nil)
                    droplet ||= app.droplet
                    no_assigned_droplet! unless droplet
                    validate_maximum_disk!(message)
              
              
              Severity: Minor
              Found in app/actions/task_create.rb - About 1 hr to fix

                Function option has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    option: function( key, value ) {
                      var options = key,
                          parts,
                          curOption,
                          i;
                Severity: Minor
                Found in docs/v3/source/javascripts/lib/_jquery_ui.js - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language