Showing 570 of 2,676 total issues
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 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 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 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 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 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
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 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 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 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 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 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)