Showing 583 of 2,698 total issues
Method create
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create(message, lifecycle)
app = nil
AppModel.db.transaction do
app = AppModel.create(
name: message.name,
Method render_json
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_json(controller, obj, opts)
inline_relations_depth = opts[:inline_relations_depth] || @default_inline_relations_depth
if inline_relations_depth > @max_inline_relations_depth
raise CloudController::Errors::ApiError.new_from_details('BadQueryParameter',
"inline_relations_depth must be <= #{@max_inline_relations_depth}")
Method start_cc
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start_cc(opts={})
@cc_pids ||= []
config_file = opts[:config] || 'config/cloud_controller.yml'
config = VCAP::CloudController::YAMLConfig.safe_load_file(config_file)
Method create_route_binding_request
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_route_binding_request(route_guid, service_instance_guid)
{
metadata: {
annotations: {
foo: 'bar'
Method record_create
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.record_create(deployment, droplet, user_audit_info, v3_app_name, space_guid, org_guid, params, type)
Method serialize_to_one_relationship
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def serialize_to_one_relationship(response, associated_model_instance, associated_controller, relationship_name, depth, opts, parents, orphans)
Method serialize_to_many_relationship
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def serialize_to_many_relationship(response, associated_model_instances, associated_controller, relationship_name, depth, opts, parents, orphans)
Method create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create(app:, user_audit_info:, message:)
deployment = nil
DeploymentModel.db.transaction do
app.lock!
- 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 validate_service_instance!
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def validate_service_instance!(service_instance)
if service_instance.managed_instance?
service_not_bindable! unless service_instance.service_plan.bindable?
service_instance_not_found! if service_instance.create_failed?
operation_in_progress! if service_instance.operation_in_progress?
- 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 create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create(app, args)
type = args[:type]
attrs = args.merge({
diego: true,
instances: default_instance_count(type),
- 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 perform
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def perform
droplet = DropletModel.find(guid: @droplet_guid)
if droplet
sha1_digest = Digester.new.digest_path(@local_path)
- 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 perform
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def perform
logger = Steno.logger('cc.background')
logger.info("Copying the package bits from package '#{@src_package_guid}' to package '#{@dest_package_guid}'")
dest_package = VCAP::CloudController::PackageModel.find(guid: @dest_package_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 perform
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def perform
logger = Steno.logger('cc.background')
logger.info("Applying app manifest to app: #{resource_guid}")
app_guid_message_hash.each do |app_guid, message|
- 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 adapt_boolean_expression
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def adapt_boolean_expression(expression)
args = expression.args.map do |arg|
case arg
when Sequel::SQL::BooleanExpression
adapt_boolean_expression(arg)
- 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 delete
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def delete(binding)
operation_in_progress! if blocking_operation_in_progress?(binding)
result = send_unbind_to_client(binding)
if result[:finished]
- 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 call
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
return call_app(env) unless env['HTTP_ORIGIN']
return call_app(env) unless @allowed_cors_domains.any? { |d| d =~ env['HTTP_ORIGIN'] }
cors_headers = {
- 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 destroy
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def destroy
service_plan = ServicePlanFetcher.fetch(hashed_params[:guid])
service_plan_not_found! unless service_plan.present? && visible_to_current_user?(plan: service_plan)
unauthorized! unless current_user_can_write?(service_plan)
unprocessable!('Cannot delete visibilities from non-org-restricted plans') unless service_plan.visibility_type == ServicePlanVisibilityTypes::ORGANIZATION
- 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 delete
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def delete(service_bindings)
bindings_to_delete = Array(service_bindings)
warnings_accumulator = []
errors = each_with_error_aggregation(bindings_to_delete) do |service_binding|
- 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 initialize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(params={})
super
params = params.deep_symbolize_keys
@requested_keys << :health_check_type if HashUtils.dig(params, :health_check)&.key?(:type)
@requested_keys << :health_check_timeout if HashUtils.dig(params, :health_check, :data)&.key?(:timeout)
- 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 send_or_redirect_blob
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def send_or_redirect_blob(blob)
raise CloudController::Errors::BlobNotFound unless blob
if @blobstore.local?
blob_sender.send_blob(blob, @controller)
- 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"