Showing 583 of 2,698 total issues
Method add_organization_role
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def add_organization_role(user_guid, relationship, org_guid)
organization = Organization.first(guid: org_guid)
user = User.first(guid: user_guid)
user.username = @uaa_username_lookup_client.usernames_for_ids([user.guid])[user.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
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def update
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 transform
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def transform(users, opts={})
user_guids = users.map(&:guid)
username_mapping = uaa_client.usernames_for_ids(user_guids)
organization_id = opts[:organization_id]
space_id = opts[:space_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 filter_by_org_guid
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def filter_by_org_guid(org_guids, plan_dataset, broker_dataset, omniscient, readable_orgs_query, readable_spaces_query, dataset)
authorized_org_guids = if !omniscient && !readable_orgs_query.nil?
readable_orgs_query.where(guid: org_guids).select_map(:guid)
else
org_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 filter_by_space_guid
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def filter_by_space_guid(space_guids, plan_dataset, broker_dataset, omniscient, readable_orgs_query, readable_spaces_query, dataset)
authorized_space_guids = if !omniscient && !readable_spaces_query.nil?
readable_spaces_query.where(guid: space_guids).select_map(:guid)
else
space_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 validate_encryption_key_values_unchanged!
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate_encryption_key_values_unchanged!(config)
encryption_key_labels = config.get(:database_encryption, :keys)
return if encryption_key_labels.blank?
labels_with_changed_keys = []
- 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 process_workpool_exceptions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def process_workpool_exceptions(exceptions)
invalid_lrps = 0
exceptions.each do |e|
error_name = e.is_a?(CloudController::Errors::ApiError) ? e.name : e.class.name
if error_name == 'RunnerInvalidRequest'
- 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_socket
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create_socket(host, port)
@debug_dev << "! CONNECT TO #{host}:#{port}\n" if @debug_dev
clean_host = host.delete('[]')
if @socket_local == HTTPClient::Site::EMPTY
socket = TCPSocket.new(clean_host, port, connect_timeout: @client.socket_connect_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 build_api_error_matcher
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def build_api_error_matcher(error_class, api_error_name, *api_error_args)
supports_block_expectations
match do |actual|
actual.call
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(env)
header_token = env['HTTP_AUTHORIZATION']
request_path = env['REQUEST_PATH']
security_context_configurer = @security_context_configurer
Method precursor
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def precursor(service_instance, message:)
validate_service_instance!(service_instance)
key = ServiceKey.first(service_instance: service_instance, name: message.name)
validate_key!(key, message.name)
Method process_create_operation
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_create_operation(logger, service_binding, last_operation_result, intended_operation)
if state_succeeded?(last_operation_result)
client = VCAP::Services::ServiceClientProvider.provide(instance: service_binding.service_instance)
begin
Method summary
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def summary(guid)
org = find_guid_and_validate_access(:read, guid)
spaces = visible_spaces(org).map do |space|
# when we do the quota work, this and the service counts will be kept
# as a running total so that we don't have to compute them on the
Method create
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create(message)
instance = nil
attributes = {
name: message.name,
space_guid: message.space_guid,
Method to_hash
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_hash
{
guid: build.guid,
created_at: build.created_at,
updated_at: build.updated_at,
Method image_layers
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def image_layers
return [] unless @config.get(:diego, :enable_declarative_asset_downloads)
lifecycle_bundle_key = :"buildpack/#{@stack}"
lifecycle_bundle = @config.get(:diego, :lifecycle_bundles)[lifecycle_bundle_key]
Method image_layers
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def image_layers
return [] unless @config.get(:diego, :enable_declarative_asset_downloads)
lifecycle_bundle_key = :"cnb/#{@stack}"
lifecycle_bundle = @config.get(:diego, :lifecycle_bundles)[lifecycle_bundle_key]
Method create_app_binding_request
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_app_binding_request(service_instance_guid, app_guid)
{
type: 'app',
metadata: {
annotations: {
Method perform
has 26 lines of code (exceeds 25 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|
Method cleanup
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cleanup(day_of_week)
logger.info("Started orphaned blobs cleanup job for day of week: #{day_of_week}")
update_existing_orphaned_blobs