cloudfoundry/cloud_controller_ng

View on GitHub
app/actions/v3/service_instance_update_managed.rb

Summary

Maintainability
C
1 day
Test Coverage

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

      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 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 raise_if_cannot_update! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def raise_if_cannot_update!
              error_code = 'ServiceInstanceWithInaccessiblePlanNotUpdateable'.freeze
              update_error = ->(x) { UnprocessableUpdate.new_from_details(error_code, x) }
              return if service_instance.service_plan.active?
              raise update_error.call('parameters') unless message.parameters.nil?
      Severity: Minor
      Found in app/actions/v3/service_instance_update_managed.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 raise_if_invalid_update! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def raise_if_invalid_update!
              return unless message.updates.any?
      
              service_instance.set(message.updates)
              return service_instance.reload if service_instance.valid?
      Severity: Minor
      Found in app/actions/v3/service_instance_update_managed.rb - About 25 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

      There are no issues that match your filters.

      Category
      Status