cloudfoundry/cloud_controller_ng

View on GitHub

Showing 556 of 2,660 total issues

Method update has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    def self.update(quota, message)
      if log_rate_limit(message) != QuotaDefinition::UNLIMITED
        spaces = spaces_with_unlimited_processes(quota)
        unlimited_processes_exist_error!(spaces) if spaces.any?
      end
Severity: Minor
Found in app/actions/space_quota_update.rb - About 6 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 _jquery_ui.js has 427 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! jQuery UI - v1.11.3 - 2015-02-12
 * http://jqueryui.com
 * Includes: widget.js
 * Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */

Severity: Minor
Found in docs/v3/source/javascripts/lib/_jquery_ui.js - About 6 hrs to fix

    File app_bits_upload_controller_spec.rb has 414 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/app_bits_upload_controller_spec.rb - About 5 hrs to fix

      Method update has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

          def update(process, message, strategy_class)
            raise InvalidProcess.new('Cannot update this process while a deployment is in flight.') if process.web? && process.app.deploying?
      
            strategy = strategy_class.new(message, process)
            process.db.transaction do
      Severity: Minor
      Found in app/actions/process_update.rb - About 5 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_lifecycle_data_model_spec.rb has 398 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'spec_helper'
      
      module VCAP::CloudController
        RSpec.describe BuildpackLifecycleDataModel do
          subject(:lifecycle_data) { BuildpackLifecycleDataModel.new }
      Severity: Minor
      Found in spec/unit/models/runtime/buildpack_lifecycle_data_model_spec.rb - About 5 hrs to fix

        File feature_flags_api_spec.rb has 398 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'spec_helper'
        require 'rspec_api_documentation/dsl'
        
        RSpec.resource 'Feature Flags', type: %i[api legacy_api] do
          let(:admin_auth_header) { admin_headers['HTTP_AUTHORIZATION'] }
        Severity: Minor
        Found in spec/api/documentation/feature_flags_api_spec.rb - About 5 hrs to fix

          File domain_create_message_spec.rb has 384 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'spec_helper'
          require 'messages/domain_create_message'
          
          module VCAP::CloudController
            RSpec.describe DomainCreateMessage do
          Severity: Minor
          Found in spec/unit/messages/domain_create_message_spec.rb - About 5 hrs to fix

            Class Permissions has 39 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class VCAP::CloudController::Permissions
              ROLES_FOR_ORG_READING ||= [
                VCAP::CloudController::Membership::ORG_MANAGER,
                VCAP::CloudController::Membership::ORG_AUDITOR,
                VCAP::CloudController::Membership::ORG_USER,
            Severity: Minor
            Found in lib/cloud_controller/permissions.rb - About 5 hrs to fix

              Method update has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
              Open

                def update
                  message = ServiceBrokerUpdateMessage.new(hashed_params[:body])
                  unprocessable!(message.errors.full_messages) unless message.valid?
              
                  service_broker = VCAP::CloudController::ServiceBroker.find(guid: hashed_params[:guid])
              Severity: Minor
              Found in app/controllers/v3/service_brokers_controller.rb - About 5 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 20160914165525_migrate_v2_app_data_to_v3.rb has 377 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              Sequel.migration do
                up do
                  collate_opts = {}
                  dbtype = if self.class.name.match?(/mysql/i)
                             collate_opts[:collate] = :utf8_bin
              Severity: Minor
              Found in db/migrations/20160914165525_migrate_v2_app_data_to_v3.rb - About 5 hrs to fix

                Class Organization has 38 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class Organization < Sequel::Model
                    ORG_NAME_REGEX = /\A[[:alnum:][:punct:][:print:]]+\Z/
                    ACTIVE = 'active'.freeze
                    SUSPENDED = 'suspended'.freeze
                    ORG_STATUS_VALUES = [ACTIVE, SUSPENDED].freeze
                Severity: Minor
                Found in app/models/runtime/organization.rb - About 5 hrs to fix

                  File catalog_spec.rb has 365 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'spec_helper'
                  
                  module VCAP::Services::ServiceBrokers::V2
                    RSpec.describe Catalog do
                      let(:broker) { VCAP::CloudController::ServiceBroker.make }
                  Severity: Minor
                  Found in spec/unit/lib/services/service_brokers/v2/catalog_spec.rb - About 4 hrs to fix

                    Class ServiceInstanceUpdateManaged has 36 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                        class ServiceInstanceUpdateManaged
                          class UnprocessableUpdate < CloudController::Errors::ApiError; end
                          class InvalidServiceInstance < StandardError
                          end
                          class LastOperationFailedState < StandardError; end
                    Severity: Minor
                    Found in app/actions/v3/service_instance_update_managed.rb - About 4 hrs to fix

                      File request_spec_shared_examples.rb has 348 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      GLOBAL_SCOPES = %w[
                        admin
                        admin_read_only
                        global_auditor
                      ].freeze
                      Severity: Minor
                      Found in spec/request_spec_shared_examples.rb - About 4 hrs to fix

                        Class BaseController has 34 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                          class BaseController
                            V2_ROUTE_PREFIX ||= '/v2'.freeze
                        
                            include VCAP::CloudController
                            include CloudController::Errors
                        Severity: Minor
                        Found in app/controllers/base/base_controller.rb - About 4 hrs to fix

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

                          require 'spec_helper'
                          
                          RSpec.describe 'CORS', type: :integration do
                            before(:all) do
                              start_cc
                          Severity: Minor
                          Found in spec/integration/cors_spec.rb - About 4 hrs to fix

                            Function porterStemmer has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                var porterStemmer = function porterStemmer(w) {
                                  var   stem,
                                      suffix,
                                      firstch,
                                      re,
                            Severity: Major
                            Found in docs/v3/source/javascripts/lib/_lunr.js - About 4 hrs to fix

                              File organization_quotas_update_message_spec.rb has 338 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              require 'spec_helper'
                              require 'messages/organization_quotas_update_message'
                              
                              module VCAP::CloudController
                                RSpec.describe OrganizationQuotasUpdateMessage do
                              Severity: Minor
                              Found in spec/unit/messages/organization_quotas_update_message_spec.rb - About 4 hrs to fix

                                File internal_package_update_message_spec.rb has 336 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                require 'spec_helper'
                                require 'messages/internal_package_update_message'
                                
                                module VCAP::CloudController
                                  RSpec.describe InternalPackageUpdateMessage do
                                Severity: Minor
                                Found in spec/unit/messages/internal_package_update_message_spec.rb - About 4 hrs to fix

                                  File service_instance_update_managed.rb has 335 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  require 'services/service_brokers/service_client_provider'
                                  require 'actions/metadata_update'
                                  require 'cloud_controller/errors/api_error'
                                  
                                  module VCAP::CloudController
                                  Severity: Minor
                                  Found in app/actions/v3/service_instance_update_managed.rb - About 4 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language