cloudfoundry/cloud_controller_ng

View on GitHub

Showing 570 of 2,676 total issues

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 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 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 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 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 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 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 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 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 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 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(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 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

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

                def serialize_relationships(relationships, controller, depth, obj, opts, parents, orphans)
        Severity: Major
        Found in app/presenters/v2/relations_presenter.rb - About 50 mins to fix

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

              def url(controller, path, page, page_size, order_direction, opts, request_params)
          Severity: Major
          Found in lib/cloud_controller/rest_controller/paginated_collection_renderer.rb - About 50 mins to fix

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

                  def filter_by_org_guid(org_guids, plan_dataset, broker_dataset, omniscient, readable_orgs_query, readable_spaces_query, dataset)
            Severity: Major
            Found in app/fetchers/base_service_list_fetcher.rb - About 50 mins to fix

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

                    def filter_by_space_guid(space_guids, plan_dataset, broker_dataset, omniscient, readable_orgs_query, readable_spaces_query, dataset)
              Severity: Major
              Found in app/fetchers/base_service_list_fetcher.rb - About 50 mins to fix

                Method bind has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                      def bind(binding, parameters: {}, accepts_incomplete: false)
                        client = VCAP::Services::ServiceClientProvider.provide(instance: binding.service_instance)
                        details = client.bind(
                          binding,
                          arbitrary_parameters: parameters,
                Severity: Minor
                Found in app/actions/v3/service_binding_create.rb - About 45 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 perform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                      def perform
                        not_found! unless service_instance
                
                        raise_if_other_operations_in_progress!
                
                
                Severity: Minor
                Found in app/jobs/v3/create_service_instance_job.rb - About 45 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 normalize_units has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                      def normalize_units(manifest_app_hash)
                        byte_measurement_key_words = %w[memory disk-quota disk_quota]
                        manifest_app_hash.each_with_index do |process_hash, index|
                          byte_measurement_key_words.each do |key|
                            value = process_hash[key]
                Severity: Minor
                Found in app/actions/space_diff_manifest.rb - About 45 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