Showing 560 of 2,663 total issues
Method validate_destination
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def validate_destination(destination, record, index)
error_message = 'destination must be a valid CIDR, IP address, or IP address range'
error_message = 'destination must contain valid CIDR(s), IP address(es), or IP address range(s)' if CloudController::RuleValidator.comma_delimited_destinations_enabled?
add_rule_error('empty destination specified in comma-delimited list', record, index) if destination.empty?
- 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_staging_spaces
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def delete_staging_spaces
resource_not_found!(:security_group) unless permission_queryer.readable_security_group_guids.include?(hashed_params[:guid])
security_group = SecurityGroup.first(guid: hashed_params[:guid])
space = Space.find(guid: hashed_params[:space_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 16 (exceeds 5 allowed). Consider refactoring. Open
def update
sidecar = SidecarModel.find(guid: params[:guid])
resource_not_found!(:sidecar) unless sidecar
space = sidecar.app.space
- 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 16 (exceeds 5 allowed). Consider refactoring. Open
def update(buildpack, message)
Buildpack.db.transaction do
Locking[name: 'buildpacks'].lock!
MetadataUpdate.update(buildpack, 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 serialize_relationships
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def serialize_relationships(relationships, controller, depth, obj, opts, parents, orphans)
response = {}
(relationships || {}).each do |relationship_name, association|
associated_model = get_associated_model_class_for(obj, association.association_name)
next unless associated_model
- 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_eager_load_hash
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def build_eager_load_hash(controller_class, model_class, default_visibility_filter, additional_visibility_filters, depth)
associated_controller = controller_class
# model_class cannot just be inferred from controller_class.model
# because ServiceInstancesController can be used to present objects
- 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
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def build(config, request_metrics, request_logs)
token_decoder = VCAP::CloudController::UaaTokenDecoder.new(config.get(:uaa))
configurer = VCAP::CloudController::Security::SecurityContextConfigurer.new(token_decoder)
logger = access_log(config)
- 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_port
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.validate_port(port)
return false if /[^\d\s\-,]/.match?(port)
port_range = /\A\s*(\d+)\s*-\s*(\d+)\s*\z/.match(port)
if port_range
- 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_destination
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.validate_destination(destination)
unless destination.index(',').nil?
return false unless comma_delimited_destinations_enabled?
destinations = destination.partition(',')
- 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
File task_action_builder_spec.rb
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
module VCAP::CloudController
module Diego
module Buildpack
Method read
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read
api_url_builder = VCAP::CloudController::Presenters::ApiUrlBuilder
response = {
links: {
Method image_layers
has 49 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 create
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create(app:, user_audit_info:, message:)
deployment = nil
DeploymentModel.db.transaction do
app.lock!
Method clone_existing_web_process
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def clone_existing_web_process(app, revision)
web_process = app.newest_web_process
command = if revision
revision.commands_by_process_type[ProcessTypes::WEB]
else
Method update
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def update(security_group, message)
security_group.db.transaction do
security_group.lock!
security_group.name = message.name if message.requested? :name
- 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 15 (exceeds 5 allowed). Consider refactoring. Open
def perform
not_found! unless resource
cancelled! if delete_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 update
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def update(app_guid, message, user_audit_info)
return unless message.requested?(:routes)
app = AppModel.find(guid: app_guid)
not_found! unless app
- 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_similarity
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def create_similarity
lambda do |before, after|
return nil unless before.is_a?(Hash) && after.is_a?(Hash)
if before.key?('type') && after.key?('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 15 (exceeds 5 allowed). Consider refactoring. Open
def update
app, space = AppFetcher.new.fetch(hashed_params[:app_guid])
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 cp_r_to_blobstore
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def cp_r_to_blobstore(source_dir)
Find.find(source_dir).each do |path|
next unless File.file?(path)
next unless within_limits?(File.size(path))
next unless File.stat(path).mode.to_s(8)[3..5].to_i(8) >= 0o600
- 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"