cloudfoundry/cloud_controller_ng

View on GitHub

Showing 569 of 2,678 total issues

Method update has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    app, space = AppFetcher.new.fetch(hashed_params[:app_guid])

    app_not_found! unless app && permission_queryer.can_read_from_space?(space.id, space.organization_id)

Severity: Minor
Found in app/controllers/v3/app_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 all_instances_for_app has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def all_instances_for_app(process)
        instances = {}
        bbs_instances_client.lrp_instances(process).each do |actual_lrp|
          next unless actual_lrp.actual_lrp_key.index < process.instances

Severity: Minor
Found in lib/cloud_controller/diego/reporters/instances_reporter.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 cp_r_to_blobstore has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def cp_r_to_blobstore(source_dir)
        Find.find(source_dir).each do |path|
          next unless File.file?(path)
          next unless within_limits?(File.size(path))
          next unless File.stat(path).mode.to_s(8)[3..5].to_i(8) >= 0o600
Severity: Minor
Found in lib/cloud_controller/blobstore/base_client.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 on_block has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

        def on_block(node)
          node.each_descendant(:send) do |inner_node|
            method = inner_node.method_name
            next unless adding_column?(method)

Severity: Minor
Found in spec/linters/migration/include_string_size.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

Function bridge has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  $.widget.bridge = function( name, object ) {
    var fullName = object.prototype.widgetFullName || name;
    $.fn[ name ] = function( options ) {
      var isMethodCall = typeof options === "string",
          args = widget_slice.call( arguments, 1 ),
Severity: Minor
Found in docs/v3/source/javascripts/lib/_jquery_ui.js - About 1 hr to fix

    Method sync has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def sync
            logger.info('run-task-sync')
            @bump_freshness = true
    
            diego_tasks = bbs_task_client.fetch_tasks.index_by(&:task_guid)
    Severity: Minor
    Found in lib/cloud_controller/diego/tasks_sync.rb - About 1 hr to fix

      Method tables_for_query_spec has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def tables_for_query_spec
          db.create_table :authors do
            primary_key :id
      
            Integer :num_val
      Severity: Minor
      Found in spec/support/bootstrap/fake_model_tables.rb - About 1 hr to fix

        Method listv5 has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def listv5
              prepare_aggregate_function
        
              bindings = ServiceBinding.
                         join(:apps, guid: :app_guid).
        Severity: Minor
        Found in app/controllers/internal/syslog_drain_urls_controller.rb - About 1 hr to fix

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

                  def to_hash
                    hash = {
                      guid: service_plan.guid,
                      created_at: service_plan.created_at,
                      updated_at: service_plan.updated_at,
          Severity: Minor
          Found in app/presenters/v3/service_plan_presenter.rb - About 1 hr to fix

            Method decorate has a Cognitive Complexity of 14 (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?
            
                  offerings = Service.
            Severity: Minor
            Found in app/decorators/field_service_instance_offering_decorator.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 call has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                  def call(env)
                    header_token = env['HTTP_AUTHORIZATION']
                    request_path = env['REQUEST_PATH']
            
                    security_context_configurer = @security_context_configurer
            Severity: Minor
            Found in middleware/security_context_setter.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 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def delete(dataset)
                  dataset.each_with_object([]) do |space_model, errors|
                    instance_delete_errors = delete_service_instances(space_model)
                    err = accumulate_space_deletion_error(instance_delete_errors, space_model.name)
                    errors << err unless err.nil?
            Severity: Minor
            Found in app/actions/space_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 update has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def update(droplet, message)
                  droplet.db.transaction do
                    droplet.lock!
            
                    if message.requested?(:image)
            Severity: Minor
            Found in app/actions/droplet_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 delete has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def delete(org_dataset)
                  org_dataset.each do |org|
                    errs = @space_deleter.delete(org.spaces_dataset)
                    unless errs.empty?
                      error_message = errs.map(&:message).join("\n\n")
            Severity: Minor
            Found in app/actions/organization_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 set has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def set(org, isolation_segment, message)
                  iso_seg_guid = message.default_isolation_segment_guid
                  if iso_seg_guid
                    invalid_relationship!(iso_seg_guid) unless isolation_segment
            
            
            Severity: Minor
            Found in app/actions/set_default_isolation_segment.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 perform has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                  def perform
                    return finish unless service_instance
            
                    self.maximum_duration_seconds = service_instance.service_plan.try(:maximum_polling_duration)
            
            
            Severity: Minor
            Found in app/jobs/v3/delete_service_instance_job.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 14 (exceeds 5 allowed). Consider refactoring.
            Open

              def create
                app, space = AppFetcher.new.fetch(hashed_params[:guid])
                resource_not_found!(:app) unless app && permission_queryer.can_read_from_space?(space.id, space.organization_id)
                unauthorized! unless permission_queryer.can_write_to_active_space?(space.id)
                suspended! unless permission_queryer.is_space_active?(space.id)
            Severity: Minor
            Found in app/controllers/v3/sidecars_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 14 (exceeds 5 allowed). Consider refactoring.
            Open

              def update
                build = BuildModel.find(guid: hashed_params[:guid])
                build_not_found! if build.blank?
            
                space = build.space
            Severity: Minor
            Found in app/controllers/v3/builds_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 number_of_starting_and_running_instances_for_process has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                  def number_of_starting_and_running_instances_for_process(process)
                    return 0 unless process.started?
            
                    running_indices = Set.new
                    bbs_instances_client.lrp_instances(process).each do |actual_lrp|
            Severity: Minor
            Found in lib/cloud_controller/diego/reporters/instances_reporter.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 install has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def install(buildpacks)
                  return unless buildpacks
            
                  CloudController::DependencyLocator.instance.buildpack_blobstore.ensure_bucket_exists
                  job_factory = VCAP::CloudController::Jobs::Runtime::BuildpackInstallerFactory.new
            Severity: Minor
            Found in lib/cloud_controller/install_buildpacks.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