cloudfoundry/cloud_controller_ng

View on GitHub

Showing 556 of 2,660 total issues

File security_group_create_message_spec.rb has 334 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'spec_helper'
require 'messages/security_group_create_message'

module VCAP::CloudController
  RSpec.describe SecurityGroupCreateMessage do
Severity: Minor
Found in spec/unit/messages/security_group_create_message_spec.rb - About 4 hrs to fix

    Method generate_diff has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

          def generate_diff(app_manifests, space)
            json_diff = []
    
            recognized_top_level_keys = AppManifestMessage.allowed_keys.map(&:to_s).map(&:dasherize)
    
    
    Severity: Minor
    Found in app/actions/space_diff_manifest.rb - About 3 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 process_stats_presenter_spec.rb has 329 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'spec_helper'
    require 'presenters/v3/process_stats_presenter'
    
    module VCAP::CloudController::Presenters::V3
      RSpec.describe ProcessStatsPresenter do
    Severity: Minor
    Found in spec/unit/presenters/v3/process_stats_presenter_spec.rb - About 3 hrs to fix

      File manifest_process_update_message_spec.rb has 329 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'spec_helper'
      require 'messages/manifest_process_update_message'
      
      module VCAP::CloudController
        RSpec.describe ManifestProcessUpdateMessage do
      Severity: Minor
      Found in spec/unit/messages/manifest_process_update_message_spec.rb - About 3 hrs to fix

        File api_schema.rb has 328 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'vcap/config'
        require 'cloud_controller/resource_pool'
        
        module VCAP::CloudController
          module ConfigSchemas
        Severity: Minor
        Found in lib/cloud_controller/config_schemas/base/api_schema.rb - About 3 hrs to fix

          File service_brokers_spec.rb has 327 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'spec_helper'
          require 'request_spec_shared_examples'
          require 'cloud_controller'
          require 'services'
          require 'messages/service_broker_update_message'
          Severity: Minor
          Found in spec/request/lifecycle/service_brokers_spec.rb - About 3 hrs to fix

            File route_create_message_spec.rb has 326 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'spec_helper'
            require 'messages/route_create_message'
            
            module VCAP::CloudController
              RSpec.describe RouteCreateMessage do
            Severity: Minor
            Found in spec/unit/messages/route_create_message_spec.rb - About 3 hrs to fix

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

                  def update(app, message, lifecycle)
                    validate_not_changing_lifecycle_type!(app, lifecycle)
              
                    app.db.transaction do
                      app.lock!
              Severity: Minor
              Found in app/actions/app_update.rb - About 3 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 process_event_repository_spec.rb has 304 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'spec_helper'
              require 'repositories/process_event_repository'
              
              module VCAP::CloudController
                module Repositories
              Severity: Minor
              Found in spec/unit/repositories/process_event_repository_spec.rb - About 3 hrs to fix

                File reoccurring_job_spec.rb has 304 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require 'rails_helper'
                require 'jobs/reoccurring_job'
                
                module VCAP
                  module CloudController
                Severity: Minor
                Found in spec/unit/jobs/reoccurring_job_spec.rb - About 3 hrs to fix

                  Class Service has 27 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                    class Service < Sequel::Model
                      plugin :serialization
                  
                      many_to_one :service_broker
                      one_to_many :service_plans
                  Severity: Minor
                  Found in app/models/services/service.rb - About 3 hrs to fix

                    File space_quotas_create_message_spec.rb has 297 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require 'spec_helper'
                    require 'messages/space_quotas_create_message'
                    
                    module VCAP::CloudController
                      RSpec.describe SpaceQuotasCreateMessage do
                    Severity: Minor
                    Found in spec/unit/messages/space_quotas_create_message_spec.rb - About 3 hrs to fix

                      Class ApplicationController has 26 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class ApplicationController < ActionController::Base
                        include VCAP::CloudController
                        include V3ErrorsHelper
                        include VCAP::CloudController::ParamsHashifier
                      
                      
                      Severity: Minor
                      Found in app/controllers/v3/application_controller.rb - About 3 hrs to fix

                        File desired_lrp_builder_spec.rb has 291 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require 'spec_helper'
                        
                        module VCAP::CloudController
                          module Diego
                            module Buildpack

                          File service_operation_shared.rb has 289 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          RSpec.shared_examples 'a model including the ServiceOperationMixin' do |service_class, operation_association, operation_class, service_key|
                            let(:service) { service_class.make }
                          
                            before do
                              @service = service
                          Severity: Minor
                          Found in spec/unit/models/services/service_operation_shared.rb - About 2 hrs to fix

                            Function widget has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              $.widget = function( name, base, prototype ) {
                                var fullName, existingConstructor, constructor, basePrototype,
                                // proxiedPrototype allows the provided prototype to remain unmodified
                                // so that it can be used as a mixin for multiple widgets (#8876)
                                    proxiedPrototype = {},
                            Severity: Major
                            Found in docs/v3/source/javascripts/lib/_jquery_ui.js - About 2 hrs to fix

                              Method create has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def create
                                  message = ServiceBrokerCreateMessage.new(hashed_params[:body])
                                  unprocessable!(message.errors.full_messages) unless message.valid?
                              
                                  if message.space_guid
                              Severity: Minor
                              Found in app/controllers/v3/service_brokers_controller.rb - About 2 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 application_controller_spec.rb has 284 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              require 'spec_helper'
                              require 'rails_helper'
                              
                              ## NOTICE: Prefer request specs over controller specs as per ADR #0003 ##
                              
                              
                              Severity: Minor
                              Found in spec/unit/controllers/v3/application_controller_spec.rb - About 2 hrs to fix

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

                                  def validate(record)
                                    unless record.rules.is_a?(Array)
                                      record.errors.add :rules, 'must be an array'
                                      return
                                    end
                                Severity: Minor
                                Found in app/messages/validators/security_group_rule_validator.rb - About 2 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

                                Method destroy has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  def destroy
                                    service_broker = VCAP::CloudController::ServiceBroker.find(guid: hashed_params[:guid])
                                    broker_not_found! unless service_broker
                                
                                    if service_broker.space.nil?
                                Severity: Minor
                                Found in app/controllers/v3/service_brokers_controller.rb - About 2 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

                                Severity
                                Category
                                Status
                                Source
                                Language