Showing 583 of 2,698 total issues
Method copy
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def copy(destination_app_guid:, source_package:, user_audit_info:, record_event: true)
raise InvalidPackage.new('Source and destination app cannot be the same') if destination_app_guid == source_package.app_guid
logger.info("copying package #{source_package.guid} to app #{destination_app_guid}")
- 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_lifecycle
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def update_lifecycle(app, process, request_attrs)
buildpack_type_requested = request_attrs.key?('buildpack') || request_attrs.key?('stack_guid')
docker_type_requested = request_attrs.key?('docker_image') || request_attrs.key?('docker_credentials')
if buildpack_type_requested
- 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 find_process_and_space
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def find_process_and_space
if app_nested?
@process, app, @space = ProcessFetcher.fetch_for_app_by_type(app_guid: hashed_params[:app_guid], process_type: hashed_params[:type])
app_not_found! unless app && permission_queryer.can_read_from_space?(@space.id, @space.organization_id)
- 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 upload
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def upload
buildpack = Buildpack.find(guid: hashed_params[:guid])
buildpack_not_found! unless buildpack
unauthorized! unless permission_queryer.can_write_globally?
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
def update(org, message)
org.db.transaction do
org.lock!
org.name = message.name if message.requested?(:name)
LabelsUpdate.update(org, message.labels, OrganizationLabelModel)
- 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 enumerate
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def enumerate
if SecurityContext.missing_token?
raise CloudController::Errors::NotAuthenticated if VCAP::CloudController::FeatureFlag.enabled?(:hide_marketplace_from_unauthenticated_users)
single_filter = @opts[:q][0] if @opts[:q]
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
def update(space, org, message)
isolation_segment_guid = message.isolation_segment_guid
if isolation_segment_guid
isolation_segment = IsolationSegmentModel.where(guid: isolation_segment_guid).first
raise_invalid_relationship!(isolation_segment_guid) unless isolation_segment
- 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 buildpacks_are_uri_or_nil
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def buildpacks_are_uri_or_nil
buildpack_infos.each do |buildpack_info|
next if buildpack_info.buildpack_record.present?
next if buildpack_info.buildpack.nil?
next if buildpack_info.buildpack_url
- 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 advanced_filtering
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def advanced_filtering(message, dataset, klass)
advanced_filters = {}
advanced_filters['created_at'] = message.created_ats if message.requested?(:created_ats)
advanced_filters['updated_at'] = message.updated_ats if message.requested?(:updated_ats)
- 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 make_parent_app
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def make_parent_app(package_attributes, parent_app_attributes, process_attributes)
return process_attributes[:app] if process_attributes[:app]
parent_app_blueprint_type = package_attributes[:docker_image].present? ? :docker : nil
parent_app_attributes[:desired_state] = process_attributes[:state] if process_attributes.key?(:state)
- 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 filter
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def filter(dataset, message)
dataset = dataset.where(service_instances__name: message.names) if message.requested?(:names)
if message.requested?(:type)
dataset = case message.type
Method build_app_task
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_app_task(config, task)
task_completion_callback = VCAP::CloudController::Diego::TaskCompletionCallbackGenerator.new(config).generate(task)
app_volume_mounts = VCAP::CloudController::Diego::Protocol::AppVolumeMounts.new(task.app).as_json
task_action_builder = LifecycleProtocol.protocol_for_type(task.droplet.lifecycle_type).task_action_builder(config, task)
Method create
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create(request_attrs)
process = nil
AppModel.db.transaction do
app = AppModel.create(
Method create
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create(app, service_instance, message, volume_mount_services_enabled, accepts_incomplete)
raise ServiceInstanceNotBindable unless service_instance.bindable?
raise VolumeMountServiceDisabled if service_instance.volume_service? && !volume_mount_services_enabled
raise SpaceMismatch unless bindable_in_space?(service_instance, app.space)
Method list
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list
prepare_aggregate_function
guid_to_drain_maps = AppModel.
join(ServiceBinding.table_name, app_guid: :guid).
join(Space.table_name, guid: :apps__space_guid).
Method build_staging_task
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_staging_task(config, staging_details)
lifecycle_type = staging_details.lifecycle.type
action_builder = LifecycleProtocol.protocol_for_type(lifecycle_type).staging_action_builder(config, staging_details)
::Diego::Bbs::Models::TaskDefinition.new({
Method image_layers
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def image_layers
return [] unless @config.get(:diego, :enable_declarative_asset_downloads)
layers = [
::Diego::Bbs::Models::ImageLayer.new(
Method make_space_quota_json
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def make_space_quota_json(space_quota, associated_spaces=space_quota.spaces)
{
guid: space_quota.guid,
created_at: iso8601,
updated_at: iso8601,
Method catalog
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def catalog
{
'services' => [
{
'id' => 'catalog1',
Method find_or_create_valid_route
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def find_or_create_valid_route(app, manifest_route, user_audit_info)
manifest_route[:candidate_host_domain_pairs].each do |candidate|
potential_domain = candidate[:domain]
existing_domain = Domain.find(name: potential_domain)
next unless existing_domain