cloudfoundry/cloud_controller_ng

View on GitHub

Showing 583 of 2,698 total issues

Method purge has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def purge(service_instance)
      logger.info("purging service instance #{service_instance.guid}")

      service_instance.db.transaction do
        service_instance.routes.each do |route|
Severity: Minor
Found in app/actions/service_instance_purge.rb - About 1 hr to fix

    Method update has 28 lines of code (exceeds 25 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 1 hr to fix

      Function main has 53 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func main() {
          e := echo.New()
          e.Logger.SetLevel(log.DEBUG)
      
          diegoURL, err := url.Parse(os.Getenv("DIEGO_URL"))
      Severity: Minor
      Found in .devcontainer/images/mockserver/main.go - About 1 hr to fix

        Method create has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def create(app:, droplet_guid:, environment_variables:, description:, commands_by_process_type:, user_audit_info:)
                RevisionModel.db.transaction do
                  next_version = calculate_next_version(app)
        
                  if (existing_revision_for_version = RevisionModel.find(app: app, version: next_version))
        Severity: Minor
        Found in app/actions/revision_create.rb - About 1 hr to fix

          Method dispatch has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def dispatch
                    logger = Steno.logger('cc.deployment_updater.update')
                    logger.info('run-deployment-update')
          
                    deployments_to_scale = DeploymentModel.where(state: DeploymentModel::DEPLOYING_STATE).all
          Severity: Minor
          Found in lib/cloud_controller/deployment_updater/dispatcher.rb - About 1 hr to fix

            Method schema has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def self.schema
                      lambda { |_dsl|
                        {
                          result: {
                            execution_metadata: String,
            Severity: Minor
            Found in lib/cloud_controller/diego/buildpack/staging_completion_handler.rb - About 1 hr to fix

              Method perform has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def perform
                      resource_dir = generate_resources
              
                      resource_timing = resource_match(resource_dir)
                      puts("resource match timing: #{resource_timing * 1000}ms")
              Severity: Minor
              Found in lib/cloud_controller/benchmark/blobstore.rb - About 1 hr to fix

                Method tables_for_sequel_case_insensitive_string_monkeypatch has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def tables_for_sequel_case_insensitive_string_monkeypatch
                    db.create_table :unique_str_defaults do
                      primary_key :id
                      String :str, unique: true
                    end
                Severity: Minor
                Found in spec/support/bootstrap/fake_model_tables.rb - About 1 hr to fix

                  Method validate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def validate
                      return unless policy_target
                      return unless additional_checks
                  
                      if requested_log_rate_limit == VCAP::CloudController::QuotaDefinition::UNLIMITED &&
                  Severity: Minor
                  Found in app/models/runtime/constraints/max_log_rate_limit_policy.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 decorate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def decorate(hash, resources)
                        hash[:included] ||= {}
                  
                        spaces = resources.map { |r| r.try(:space) || r }.uniq
                        all_spaces_readable, readable_space_guids = permissions(spaces)
                  Severity: Minor
                  Found in app/decorators/field_service_instance_space_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 create has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def create(message)
                        Buildpack.db.transaction do
                          Locking[name: 'buildpacks'].lock!
                  
                          buildpack = Buildpack.create(
                  Severity: Minor
                  Found in app/actions/buildpack_create.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_sync has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def update_sync
                          if update_metadata_only?
                            service_instance.db.transaction do
                              MetadataUpdate.update(service_instance, message)
                            end
                  Severity: Minor
                  Found in app/actions/v3/service_instance_update_managed.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 open_ports has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def open_ports
                        open_ports = ports || []
                  
                        if docker?
                          has_mapping_without_port = route_mappings_dataset.where(app_port: ProcessModel::NO_APP_PORT_SPECIFIED).any?
                  Severity: Minor
                  Found in app/models/runtime/process_model.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 docker_ports has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def docker_ports
                        exposed_ports = []
                        if execution_metadata.present?
                          begin
                            metadata = Oj.load(execution_metadata)
                  Severity: Minor
                  Found in app/models/runtime/droplet_model.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 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def update(accepts_incomplete: false)
                          client = VCAP::Services::ServiceClientProvider.provide(instance: service_instance)
                          details, err = client.update(
                            service_instance,
                            service_plan,
                  Severity: Minor
                  Found in app/actions/v3/service_instance_update_managed.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 data_content has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def data_content
                        return if data.nil?
                  
                        errors.add(:data, 'can only accept one key') unless data.keys.length == 1
                        errors.add(:data, "can only accept key 'guid'") unless data.key?(:guid)
                  Severity: Minor
                  Found in app/messages/route_transfer_owner_message.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 check_unwritable_spaces has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def check_unwritable_spaces(space_guids)
                      unauthorized_space = false
                      suspended_space = false
                      space_guids.each do |space_guid|
                        space = Space.find(guid: space_guid)
                  Severity: Minor
                  Found in app/controllers/v3/security_groups_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 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def update
                      flag = find_flag(hashed_params[:name])
                      flag_not_found! unless flag
                  
                      unauthorized! unless permission_queryer.can_write_globally?
                  Severity: Minor
                  Found in app/controllers/v3/feature_flags_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 delete has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def delete(service_instance_dataset)
                        service_instance_dataset.each_with_object([[], []]) do |service_instance, errors_and_warnings|
                          errors_accumulator, warnings_accumulator = errors_and_warnings
                  
                          if service_instance.operation_in_progress?
                  Severity: Minor
                  Found in app/actions/services/service_instance_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 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def update
                      resource_not_found!(:security_group) unless permission_queryer.readable_security_group_guids.include?(hashed_params[:guid])
                      security_group = SecurityGroup.first(guid: hashed_params[:guid])
                  
                      unauthorized! unless permission_queryer.can_write_globally?
                  Severity: Minor
                  Found in app/controllers/v3/security_groups_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

                  Severity
                  Category
                  Status
                  Source
                  Language