cloudfoundry/cloud_controller_ng

View on GitHub

Showing 583 of 2,698 total issues

Method droplet_buildpack_info has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def droplet_buildpack_info
          return nil if droplet.docker?
          return nil unless droplet.lifecycle_data&.buildpack_lifecycle_buildpacks

          droplet.lifecycle_data.buildpack_lifecycle_buildpacks.map do |buildpack|
Severity: Minor
Found in app/presenters/v3/droplet_presenter.rb - About 55 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 check_utf8_encoding! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def check_utf8_encoding!(yaml_data)
    if yaml_data.is_a?(Hash)
      yaml_data.each_value do |value|
        check_utf8_encoding!(value)
      end
Severity: Minor
Found in app/controllers/v3/application_controller.rb - About 55 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 mode_validator has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def mode_validator(mode)
      return if mode.nil?

      unless mode.is_a?(String)
        errors.add(:resources, "#{RESOURCE_ERROR_PREAMBLE} a non-string mode") unless errors.added?(
Severity: Minor
Found in app/messages/resource_match_create_message.rb - About 55 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 show has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def show
    service_broker = VCAP::CloudController::ServiceBroker.find(guid: hashed_params[:guid])
    broker_not_found! unless service_broker

    if service_broker.space_guid
Severity: Minor
Found in app/controllers/v3/service_brokers_controller.rb - About 55 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_or_create_options has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def update_or_create_options(hash, opts)
      results = {}
      attrs = import_attrs || []
      attrs -= opts[:only] unless opts[:only].nil?
      attrs.each do |attr|
Severity: Minor
Found in lib/sequel_plugins/vcap_serialization.rb - About 55 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 no_leading_zeros_in_address has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private_class_method def self.no_leading_zeros_in_address(address)
      address.split('.') do |octet|
        if octet.start_with?('0') && octet.length > 1
          octet_parts = octet.split('/')
          return false if octet_parts.length < 2
Severity: Minor
Found in lib/cloud_controller/rule_validator.rb - About 55 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 upload_buildpack has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def upload_buildpack(buildpack, bits_file_path, new_filename)
      return false if buildpack.locked

      sha256 = Digester.new(algorithm: OpenSSL::Digest::SHA256).digest_path(bits_file_path)
      new_key = "#{buildpack.guid}_#{sha256}"
Severity: Minor
Found in lib/cloud_controller/upload_buildpack.rb - About 55 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 anonymize_ip has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def anonymize_ip(request_ip)
        # Remove last octet of ip if EU GDPR compliance is needed
        ip = begin
          IPAddr.new(request_ip)
        rescue StandardError
Severity: Minor
Found in lib/cloud_controller/logs/request_logs.rb - About 55 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 start has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def start
      # add quit trap as in QuitTrap monkey patch
      trap('QUIT') do
        Thread.new { say 'Exiting...' }
        stop
Severity: Minor
Found in lib/delayed_job/threaded_worker.rb - About 55 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 filtered_dataset has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def filtered_dataset
      filter_args_from_query.inject(@dataset) do |filter, cond|
        if cond.is_a?(Hash)
          if cond.key?(:organization)
            org_filter(filter, cond)
Severity: Minor
Found in app/fetchers/queries/app_query.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

      def filter(dataset, message)
        dataset = dataset.where(service_instances__name: message.names) if message.requested?(:names)

        if message.requested?(:type)
          dataset = case message.type
Severity: Minor
Found in app/fetchers/service_instance_list_fetcher.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

      def filter(message, dataset)
        dataset = dataset.where(host: message.hosts) if message.requested?(:hosts)

        dataset = dataset.where(path: message.paths) if message.requested?(:paths)

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

    def decode_token_with_key(auth_token, options)
      time = Time.now.utc.to_i
      if @alternate_reference_time
        time = @alternate_reference_time
        @logger.info("using alternate reference time of #{Time.at(@alternate_reference_time)} to calculate token expiry instead of current time")
Severity: Minor
Found in lib/cloud_controller/uaa/uaa_token_decoder.rb - About 55 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 query_datetime_values has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def query_datetime_values(key, values, comparison)
      # This filter assumes that datetimes might be stored with sub-second precision,
      # but the user will only see the times truncated at the second. Chances are that
      # queries are based on an object's timestamp rather than an arbitrary time value,
      # so we accept any value in that second range. These queries will pick up other
Severity: Minor
Found in lib/vcap/rest_api/query.rb - About 55 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? has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def valid?
      return @valid if defined? @valid

      if @service_instance_data
        validate_hash!(:service_instance, @service_instance_data)
Severity: Minor
Found in lib/services/service_brokers/v2/catalog_schemas.rb - About 55 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? has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def valid?
      return @valid if defined? @valid

      if @create_data
        validate_hash!(:create, @create_data)
Severity: Minor
Found in lib/services/service_brokers/v2/service_instance_schema.rb - About 55 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 synchronize_clients_with_catalog has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def synchronize_clients_with_catalog(catalog)
      requested_clients = catalog.services.map(&:dashboard_client).compact
      requested_client_ids = requested_clients.pluck('id')

      unless cc_configured_to_modify_uaa_clients?
Severity: Minor
Found in lib/services/sso/dashboard_client_manager.rb - About 55 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 initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def initialize(job, event_repository, event_creation_method, event_type, model_class, model_guid, params={})
Severity: Major
Found in app/jobs/audit_event_job.rb - About 50 mins to fix

    Method deployment_for_stopped_app has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def deployment_for_stopped_app(app, message, previous_deployment, previous_droplet, revision, target_state, user_audit_info)
    Severity: Major
    Found in app/actions/deployment_create.rb - About 50 mins to fix

      Method initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def initialize(config, logger, env, params, body, sinatra=nil, dependencies={})
      Severity: Major
      Found in app/controllers/base/base_controller.rb - About 50 mins to fix
        Severity
        Category
        Status
        Source
        Language