Showing 556 of 2,660 total issues
Method create_and_stage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_and_stage(package:, lifecycle:, metadata: nil, start_after_staging: false)
logger.info("creating build for package #{package.guid}")
staging_in_progress! if package.app.staging_in_progress?
raise InvalidPackage.new('Cannot stage package whose state is not ready.') if package.state != PackageModel::READY_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 delete_service_instances
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def delete_service_instances(space_model)
space_model.service_instances_dataset.each_with_object([]) do |service_instance, errors|
service_instance_deleter = V3::ServiceInstanceDelete.new(service_instance, @services_event_repository)
result = service_instance_deleter.delete
unless 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 validate_quotas!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_quotas!(errors)
quota_errors = errors.on(:quota).to_a
plan_errors = errors.on(:service_plan).to_a
code = if quota_errors.include?(:service_instance_space_quota_exceeded)
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def perform
service_instance = ManagedServiceInstance.first(guid: service_instance_guid)
return if service_instance.nil?
intended_operation = service_instance.last_operation
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
rate_limit_headers = RateLimitHeaders.new(@header_suffix)
if apply_rate_limiting?(env)
user_guid = user_token?(env) ? env['cf.user_guid'] : client_ip(ActionDispatch::Request.new(env))
- 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 user_input_combinations
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def user_input_combinations
errors.add(:username, 'cannot be specified when identifying user by guid') if has_user_guid? && has_username?
errors.add(:user_origin, 'cannot be specified when identifying user by guid') if has_user_guid? && has_user_origin?
- 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 valid_requirement?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def valid_requirement?(requirement)
return VCAP::CloudController::MetadataError.error(INVALID_LABEL_SELECTOR_ERROR) if requirement.nil?
res = MetadataValidatorHelper.new(key: requirement.key).key_error
return res unless res.is_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"
Further reading
Method validate_web_port!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_web_port!
return unless process.web?
return if requested_port.nil?
return if process.docker?
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def create
unauthorized! unless current_user
FeatureFlag.raise_unless_enabled!(:app_bits_upload)
message = VCAP::CloudController::ResourceMatchCreateMessage.new(hashed_params)
- 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 organization_or_space_input_combinations
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def organization_or_space_input_combinations
errors.add(:base, 'must specify either a space or an organization.') if space_data.nil? && organization_data.nil?
errors.add(:space, "cannot be provided with the organization role type: '#{type}'.") if space_data && VCAP::CloudController::RoleTypes::ORGANIZATION_ROLES.include?(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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update
stack = Stack.find(guid: hashed_params[:guid])
stack_not_found! unless stack
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 validate_memory_allocation!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_memory_allocation!(message, sidecar)
process_types = if message.requested?(:process_types)
message.process_types
else
sidecar.process_types
- 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_not_changing_lifecycle_type!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_not_changing_lifecycle_type!(process, request_attrs)
buildpack_type_requested = request_attrs.key?('buildpack') || request_attrs.key?('stack_guid')
docker_type_requested = request_attrs.key?('docker_image')
type_is_docker = process.app.lifecycle_type == DockerLifecycleDataModel::LIFECYCLE_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 unmapped_valid?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def unmapped_valid?
errors.add(:base, "Mass delete not supported for routes. Use 'unmapped=true' parameter to delete all unmapped routes.") unless requested?(:unmapped)
unless %w[true false].include?(unmapped)
errors.add(:unmapped, 'must be a boolean')
- 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 map_space_roles
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def map_space_roles(user_guids, space_id)
space = Space.find(id: space_id)
developer_guids = subset_of_guids(space.developers_dataset, user_guids)
manager_guids = subset_of_guids(space.managers_dataset, user_guids)
auditor_guids = subset_of_guids(space.auditors_dataset, user_guids)
- 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 mutually_exclusive_fields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def mutually_exclusive_fields
errors.add(:base, 'Cannot associate an internal domain with an organization') if requested?(:internal) && internal == true && requested?(:relationships)
errors.add(:base, 'Internal domains cannot be associated to a router group.') if requested?(:internal) && internal == true && requested?(:router_group)
return unless requested?(:relationships) && requested?(:router_group)
- 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 router_group_validation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def router_group_validation
return if router_group.nil?
return errors.add(:router_group, 'must be an object') unless router_group.is_a?(Hash)
extra_keys = router_group.keys - [: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 create_service_key
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_service_key(request_attrs)
service_instance = ServiceInstance.first(guid: request_attrs['service_instance_guid'])
raise ServiceInstanceNotFound unless service_instance
raise ServiceInstanceNotBindable unless service_instance.bindable?
raise ServiceInstanceUserProvided if service_instance.user_provided_instance?
- 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_process!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_process!(process)
raise CloudController::Errors::ApiError.new_from_details('AppNotFound', process.guid) unless process.web?
raise CloudController::Errors::ApiError.new_from_details('StagingError', 'App must have at least 1 instance to stage.') if process.instances < 1
- 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_weight
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_weight(destination_index, weight)
return unless weight
unless @replace
add_destination_error(destination_index, 'weighted destinations can only be used when replacing all destinations.')
- 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"