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
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
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
- Read upRead up
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,
- Read upRead up
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?
- Read upRead up
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?
- Read upRead up
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"