cloudfoundry/cloud_controller_ng

View on GitHub

Showing 570 of 2,676 total issues

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

      def create(app:, droplet_guid:, environment_variables:, description:, commands_by_process_type:, user_audit_info:)
        RevisionModel.db.transaction do
          next_version = calculate_next_version(app)

          if (existing_revision_for_version = RevisionModel.find(app: app, version: next_version))
Severity: Minor
Found in app/actions/revision_create.rb - About 1 hr to fix

    Method schema has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def self.schema
              lambda { |_dsl|
                {
                  result: {
                    execution_metadata: String,
    Severity: Minor
    Found in lib/cloud_controller/diego/buildpack/staging_completion_handler.rb - About 1 hr to fix

      Method perform has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def perform
              resource_dir = generate_resources
      
              resource_timing = resource_match(resource_dir)
              puts("resource match timing: #{resource_timing * 1000}ms")
      Severity: Minor
      Found in lib/cloud_controller/benchmark/blobstore.rb - About 1 hr to fix

        Method tables_for_sequel_case_insensitive_string_monkeypatch has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def tables_for_sequel_case_insensitive_string_monkeypatch
            db.create_table :unique_str_defaults do
              primary_key :id
              String :str, unique: true
            end
        Severity: Minor
        Found in spec/support/bootstrap/fake_model_tables.rb - About 1 hr to fix

          Method update_sync has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def update_sync
                  if update_metadata_only?
                    service_instance.db.transaction do
                      MetadataUpdate.update(service_instance, message)
                    end
          Severity: Minor
          Found in app/actions/v3/service_instance_update_managed.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 validate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def validate
              return unless policy_target
              return unless additional_checks
          
              if requested_log_rate_limit == VCAP::CloudController::QuotaDefinition::UNLIMITED &&
          Severity: Minor
          Found in app/models/runtime/constraints/max_log_rate_limit_policy.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 docker_ports has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def docker_ports
                exposed_ports = []
                if execution_metadata.present?
                  begin
                    metadata = Oj.load(execution_metadata)
          Severity: Minor
          Found in app/models/runtime/droplet_model.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 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def update(accepts_incomplete: false)
                  client = VCAP::Services::ServiceClientProvider.provide(instance: service_instance)
                  details, err = client.update(
                    service_instance,
                    service_plan,
          Severity: Minor
          Found in app/actions/v3/service_instance_update_managed.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 open_ports has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def open_ports
                open_ports = ports || []
          
                if docker?
                  has_mapping_without_port = route_mappings_dataset.where(app_port: ProcessModel::NO_APP_PORT_SPECIFIED).any?
          Severity: Minor
          Found in app/models/runtime/process_model.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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def create(message)
                Buildpack.db.transaction do
                  Locking[name: 'buildpacks'].lock!
          
                  buildpack = Buildpack.create(
          Severity: Minor
          Found in app/actions/buildpack_create.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 delete has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def delete(service_instance_dataset)
                service_instance_dataset.each_with_object([[], []]) do |service_instance, errors_and_warnings|
                  errors_accumulator, warnings_accumulator = errors_and_warnings
          
                  if service_instance.operation_in_progress?
          Severity: Minor
          Found in app/actions/services/service_instance_delete.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 add_organization_role has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def add_organization_role(user_guid, relationship, org_guid)
                organization = Organization.first(guid: org_guid)
                user = User.first(guid: user_guid)
                user.username = @uaa_username_lookup_client.usernames_for_ids([user.guid])[user.guid] || ''
          
          
          Severity: Minor
          Found in app/controllers/runtime/users_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 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def update
              flag = find_flag(hashed_params[:name])
              flag_not_found! unless flag
          
              unauthorized! unless permission_queryer.can_write_globally?
          Severity: Minor
          Found in app/controllers/v3/feature_flags_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 check_unwritable_spaces has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def check_unwritable_spaces(space_guids)
              unauthorized_space = false
              suspended_space = false
              space_guids.each do |space_guid|
                space = Space.find(guid: space_guid)
          Severity: Minor
          Found in app/controllers/v3/security_groups_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 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def update
              buildpack = Buildpack.find(guid: hashed_params[:guid])
              buildpack_not_found! unless buildpack
          
              unauthorized! unless permission_queryer.can_write_globally?
          Severity: Minor
          Found in app/controllers/v3/buildpacks_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 transform has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def transform(users, opts={})
                user_guids = users.map(&:guid)
                username_mapping = uaa_client.usernames_for_ids(user_guids)
                organization_id = opts[:organization_id]
                space_id = opts[:space_id]
          Severity: Minor
          Found in app/collection_transformers/usernames_and_roles_populator.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 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def update
              resource_not_found!(:security_group) unless permission_queryer.readable_security_group_guids.include?(hashed_params[:guid])
              security_group = SecurityGroup.first(guid: hashed_params[:guid])
          
              unauthorized! unless permission_queryer.can_write_globally?
          Severity: Minor
          Found in app/controllers/v3/security_groups_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 data_content has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def data_content
                return if data.nil?
          
                errors.add(:data, 'can only accept one key') unless data.keys.length == 1
                errors.add(:data, "can only accept key 'guid'") unless data.key?(:guid)
          Severity: Minor
          Found in app/messages/route_transfer_owner_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 filter_by_org_guid has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def filter_by_org_guid(org_guids, plan_dataset, broker_dataset, omniscient, readable_orgs_query, readable_spaces_query, dataset)
                  authorized_org_guids = if !omniscient && !readable_orgs_query.nil?
                                           readable_orgs_query.where(guid: org_guids).select_map(:guid)
                                         else
                                           org_guids
          Severity: Minor
          Found in app/fetchers/base_service_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 filter_by_space_guid has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def filter_by_space_guid(space_guids, plan_dataset, broker_dataset, omniscient, readable_orgs_query, readable_spaces_query, dataset)
                  authorized_space_guids = if !omniscient && !readable_spaces_query.nil?
                                             readable_spaces_query.where(guid: space_guids).select_map(:guid)
                                           else
                                             space_guids
          Severity: Minor
          Found in app/fetchers/base_service_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

          Severity
          Category
          Status
          Source
          Language