cloudfoundry/cloud_controller_ng

View on GitHub

Showing 556 of 2,660 total issues

Method define_message has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def define_message(type)
        attrs   = Array(attributes)
        to_one  = @to_one_relationships ||= []
        to_many = @to_many_relationships ||= []

Severity: Minor
Found in lib/cloud_controller/rest_controller/messages.rb - About 2 hrs 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 sync has a Cognitive Complexity of 20 (exceeds 5 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 2 hrs 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 extract_table_of_contents has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def extract_table_of_contents(html)
    page = Nokogiri::HTML(html)

    headings = []
    page.css('h1,h2,h3').each do |heading|
Severity: Minor
Found in docs/v3/helpers/docs_helpers.rb - About 2 hrs 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

File buildpack_installer_factory_spec.rb has 277 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'spec_helper'

module VCAP::CloudController
  module Jobs::Runtime
    RSpec.describe BuildpackInstallerFactory do
Severity: Minor
Found in spec/unit/jobs/runtime/buildpack_installer_factory_spec.rb - About 2 hrs to fix

    File app_create_message_spec.rb has 275 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'spec_helper'
    require 'messages/app_create_message'
    
    module VCAP::CloudController
      RSpec.describe AppCreateMessage do
    Severity: Minor
    Found in spec/unit/messages/app_create_message_spec.rb - About 2 hrs to fix

      Method scale has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def scale
            raise InvalidProcess.new('Cannot scale this process while a deployment is in flight.') if @process.web? && @process.app.deploying?
      
            @process.db.transaction do
              @process.app.lock!
      Severity: Minor
      Found in app/actions/process_scale.rb - About 2 hrs 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 19 (exceeds 5 allowed). Consider refactoring.
      Open

        def valid?
          attributes.each do |attribute_name, details|
            field = fields[attribute_name]
            if field
              @attributes_with_bad_default << [attribute_name, details[:default], field.default] unless details[:default] == field.default
      Severity: Minor
      Found in spec/support/matchers/have_attributes.rb - About 2 hrs 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

      File list_message_spec.rb has 273 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'spec_helper'
      require 'messages/list_message'
      
      class VCAP::CloudController::ListMessage
        register_allowed_keys []
      Severity: Minor
      Found in spec/unit/messages/list_message_spec.rb - About 2 hrs to fix

        File service_binding_create_message_spec.rb has 271 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'spec_helper'
        require 'messages/service_binding_create_message'
        
        module VCAP::CloudController
          RSpec.describe ServiceBindingCreateMessage do
        Severity: Minor
        Found in spec/unit/messages/service_binding_create_message_spec.rb - About 2 hrs to fix

          Method perform has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

                  def perform
                    logger = Steno.logger('cc-background')
          
                    service_binding = ServiceBinding.first(guid: service_binding_guid)
                    return if service_binding.nil? # assume the binding has been purged
          Severity: Minor
          Found in app/jobs/v2/services/service_binding_state_fetch.rb - About 2 hrs 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 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def update(service_instance, message)
                logger = Steno.logger('cc.action.user_provided_service_instance_update')
          
                updates = {}
                updates[:name] = message.name if message.requested?(:name)
          Severity: Minor
          Found in app/actions/service_instance_update_user_provided.rb - About 2 hrs 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_destination_contents has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def validate_destination_contents
                app_to_ports_hash = {}
          
                destinations.each_with_index do |dst, index|
                  unless dst.is_a?(Hash)
          Severity: Minor
          Found in app/messages/route_update_destinations_message.rb - About 2 hrs 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 key_error has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def key_error
                return MetadataError.error('key cannot be empty string') unless valid_key_presence?(key)
                return MetadataError.error("key has more than one '/'") unless valid_key_format?
                return MetadataError.error("prefix '#{prefix}' must be in valid dns format") unless valid_prefix_format?
                return MetadataError.error("prefix '#{prefix[0...8]}...' is greater than #{MAX_METADATA_PREFIX_SIZE} characters") unless valid_prefix_size?
          Severity: Minor
          Found in app/messages/metadata_validator_helper.rb - About 2 hrs 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_job has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def create_job(job_class)
                params = job_class.instance_method(:initialize).parameters
                args = []
                kwargs = {}
                block = nil
          Severity: Minor
          Found in spec/support/shared_examples/jobs/delayed_job.rb - About 2 hrs 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

          File quotas_apps_message_spec.rb has 267 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'spec_helper'
          
          module VCAP::CloudController
            RSpec.describe QuotasAppsMessage do
              subject { QuotasAppsMessage.new(params) }
          Severity: Minor
          Found in spec/unit/messages/quotas_apps_message_spec.rb - About 2 hrs to fix

            File registry_bits_packer_spec.rb has 265 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'spec_helper'
            require 'cloud_controller/packager/registry_bits_packer'
            
            module CloudController::Packager
              RSpec.describe RegistryBitsPacker do
            Severity: Minor
            Found in spec/unit/lib/cloud_controller/packager/registry_bits_packer_spec.rb - About 2 hrs to fix

              Class Updater has 22 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class Updater
                    attr_reader :deployment, :logger
              
                    def initialize(deployment, logger)
                      @deployment = deployment
              Severity: Minor
              Found in lib/cloud_controller/deployment_updater/updater.rb - About 2 hrs to fix

                File buildpack_bits_controller_spec.rb has 263 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require 'spec_helper'
                
                ## NOTICE: Prefer request specs over controller specs as per ADR #0003 ##
                
                module VCAP::CloudController
                Severity: Minor
                Found in spec/unit/controllers/runtime/buildpack_bits_controller_spec.rb - About 2 hrs to fix

                  File v3_error_hasher_spec.rb has 263 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'lightweight_spec_helper'
                  require 'presenters/v3_error_hasher'
                  require 'cloud_controller/errors/api_error'
                  require 'cloud_controller/errors/not_authenticated'
                  require 'cloud_controller/errors/compound_error'
                  Severity: Minor
                  Found in spec/unit/presenters/v3/v3_error_hasher_spec.rb - About 2 hrs to fix

                    File cors_spec.rb has 263 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require 'spec_helper'
                    require 'cors'
                    
                    module CloudFoundry
                      module Middleware
                    Severity: Minor
                    Found in spec/unit/middleware/cors_spec.rb - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language