cloudfoundry/cloud_controller_ng

View on GitHub

Showing 583 of 2,698 total issues

Method validate_web_port! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def validate_web_port!
        return unless process.web?
        return if requested_port.nil?
        return if process.docker?

Severity: Minor
Found in app/actions/v2/route_mapping_create.rb - About 25 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_weight has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_weight(destination_index, weight)
      return unless weight

      unless @replace
        add_destination_error(destination_index, 'weighted destinations can only be used when replacing all destinations.')
Severity: Minor
Found in app/messages/route_update_destinations_message.rb - About 25 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 parse_maintenance_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_maintenance_info(maintenance_info)
      return {} unless maintenance_info
      return maintenance_info if maintenance_info.is_a?(Hash)

      Oj.load(maintenance_info)
Severity: Minor
Found in app/presenters/mixins/services_presentation_helpers.rb - About 25 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_one has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def delete_one(service_instance)
      errors = []

      return [] unless service_instance.exists?

Severity: Minor
Found in app/actions/services/service_instance_delete.rb - About 25 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_requirement? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def valid_requirement?(requirement)
      return VCAP::CloudController::MetadataError.error(INVALID_LABEL_SELECTOR_ERROR) if requirement.nil?

      res = MetadataValidatorHelper.new(key: requirement.key).key_error
      return res unless res.is_valid?
Severity: Minor
Found in app/messages/validators/label_selector_requirement_validator.rb - About 25 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_not_changing_lifecycle_type! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def validate_not_changing_lifecycle_type!(process, request_attrs)
        buildpack_type_requested = request_attrs.key?('buildpack') || request_attrs.key?('stack_guid')
        docker_type_requested    = request_attrs.key?('docker_image')

        type_is_docker    = process.app.lifecycle_type == DockerLifecycleDataModel::LIFECYCLE_TYPE
Severity: Minor
Found in app/actions/v2/app_update.rb - About 25 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 update_keys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def update_keys(last_fetched_keys)
      validation_hash = fetch_from_uaa

      unless validation_hash.present? || last_fetched_keys
        logger.error('Fetching uaa verification keys failed')
Severity: Minor
Found in lib/cloud_controller/uaa/uaa_verification_keys.rb - About 25 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 build has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def build
        app_env = app.environment_variables || {}

        task_env =
          initial_envs.
Severity: Minor
Found in lib/cloud_controller/diego/task_environment.rb - About 25 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 can_decrypt_all_rows! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def can_decrypt_all_rows!(config)
        # Terminology: a present string has at least one char (so the nil value is not present)
        #              a blank string is the opposite of a present string
        # Note: String#blank? is true for non-empty strings containing only whitespace characters.
        # It's *possible* for an encryption key to fit this property but very bad form, so we don't worry about it.
Severity: Minor
Found in lib/cloud_controller/validate_database_keys.rb - About 25 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 user_from_token has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def user_from_token(token)
        guid = token && (token['user_id'] || token['client_id'])
        return unless guid

        user = User.find(guid: guid.to_s)
Severity: Minor
Found in lib/cloud_controller/security/security_context_configurer.rb - About 25 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 http_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def http_info(process_eager)
          route_mappings = process_eager[0].route_mappings.reject do |route_mapping|
            route_mapping.route.internal? || route_mapping.route.tcp?
          end

Severity: Minor
Found in lib/cloud_controller/diego/protocol/routing_info.rb - About 25 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 provide has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def self.provide(ca_cert_path: nil, connect_timeout: nil, receive_timeout: nil)
        client = HTTPClient.new
        client.connect_timeout = connect_timeout if connect_timeout
        client.receive_timeout = receive_timeout if receive_timeout
        client.ssl_config.verify_mode = VCAP::CloudController::Config.config.get(:skip_cert_verify) ? OpenSSL::SSL::VERIFY_NONE : OpenSSL::SSL::VERIFY_PEER
Severity: Minor
Found in lib/cloud_controller/blobstore/webdav/http_client_provider.rb - About 25 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 paginate_with_window_function has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def paginate_with_window_function(dataset, per_page, page, table_name)
      dataset = dataset.from_self if dataset.opts[:distinct]

      paged_dataset = dataset.limit(per_page, (page - 1) * per_page)

Severity: Minor
Found in lib/cloud_controller/paging/sequel_paginator.rb - About 25 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 with_request_error_handling has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def with_request_error_handling
      tries ||= 3
      yield
    rescue StandardError
      retry unless (tries -= 1).zero?
Severity: Minor
Found in lib/cloud_controller/uaa/uaa_token_decoder.rb - About 25 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 cached_dependencies has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def cached_dependencies
          return nil if @config.get(:diego, :enable_declarative_asset_downloads)

          dependencies = [
            ::Diego::Bbs::Models::CachedDependency.new(
Severity: Minor
Found in lib/cloud_controller/diego/buildpack/staging_action_builder.rb - About 25 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 hashify has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def hashify(source)
    if source.respond_to?(:to_h)
      source.to_h
    elsif source.respond_to?(:to_hash)
      source.to_hash
Severity: Minor
Found in lib/cloud_controller/structured_error.rb - About 25 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 human_readable_byte_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def human_readable_byte_value(bytes)
      return nil if bytes.blank?

      raise InvalidBytesError unless bytes.is_a?(Integer)

Severity: Minor
Found in lib/cloud_controller/app_manifest/byte_converter.rb - About 25 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 uploaded_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def uploaded_file(params, resource_name)
    raise MissingFilePathError.new('File field missing path information') if HashUtils.dig(params, VCAP::CloudController::Constants::INVALID_NGINX_UPLOAD_PARAM)

    file_path = nginx_uploaded_file(params, resource_name) || rack_temporary_file(params, resource_name)
    return unless file_path
Severity: Minor
Found in lib/cloud_controller/upload_handler.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

      def filter(message, dataset)
        if message.requested?(:after_guid)
          last_event = dataset.first(guid: message.after_guid[0])
          invalid_after_guid! unless last_event

Severity: Minor
Found in app/fetchers/service_usage_event_list_fetcher.rb - About 25 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 fill_unreported_instances_with_down_instances has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def fill_unreported_instances_with_down_instances(reported_instances, process, flat:)
        process.instances.times do |i|
          next if reported_instances[i]

          down_instance = { state: VCAP::CloudController::Diego::LRP_DOWN }
Severity: Minor
Found in lib/cloud_controller/diego/reporters/reporter_mixins.rb - About 25 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