Showing 583 of 2,698 total issues
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 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"
Further reading
Method parse_maintenance_info
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_maintenance_info(maintenance_info)
return {} unless maintenance_info
return maintenance_info if maintenance_info.is_a?(Hash)
Oj.load(maintenance_info)
- 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_one
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def delete_one(service_instance)
errors = []
return [] unless service_instance.exists?
- 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_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 update_keys
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_keys(last_fetched_keys)
validation_hash = fetch_from_uaa
unless validation_hash.present? || last_fetched_keys
logger.error('Fetching uaa verification keys failed')
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def build
app_env = app.environment_variables || {}
task_env =
initial_envs.
- 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 can_decrypt_all_rows!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def can_decrypt_all_rows!(config)
# Terminology: a present string has at least one char (so the nil value is not present)
# a blank string is the opposite of a present string
# Note: String#blank? is true for non-empty strings containing only whitespace characters.
# It's *possible* for an encryption key to fit this property but very bad form, so we don't worry about it.
- 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_from_token
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def user_from_token(token)
guid = token && (token['user_id'] || token['client_id'])
return unless guid
user = User.find(guid: guid.to_s)
- 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 http_info
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def http_info(process_eager)
route_mappings = process_eager[0].route_mappings.reject do |route_mapping|
route_mapping.route.internal? || route_mapping.route.tcp?
end
- 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 provide
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.provide(ca_cert_path: nil, connect_timeout: nil, receive_timeout: nil)
client = HTTPClient.new
client.connect_timeout = connect_timeout if connect_timeout
client.receive_timeout = receive_timeout if receive_timeout
client.ssl_config.verify_mode = VCAP::CloudController::Config.config.get(:skip_cert_verify) ? OpenSSL::SSL::VERIFY_NONE : OpenSSL::SSL::VERIFY_PEER
- 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 paginate_with_window_function
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def paginate_with_window_function(dataset, per_page, page, table_name)
dataset = dataset.from_self if dataset.opts[:distinct]
paged_dataset = dataset.limit(per_page, (page - 1) * per_page)
- 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 with_request_error_handling
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def with_request_error_handling
tries ||= 3
yield
rescue StandardError
retry unless (tries -= 1).zero?
- 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 cached_dependencies
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def cached_dependencies
return nil if @config.get(:diego, :enable_declarative_asset_downloads)
dependencies = [
::Diego::Bbs::Models::CachedDependency.new(
- 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 hashify
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def hashify(source)
if source.respond_to?(:to_h)
source.to_h
elsif source.respond_to?(:to_hash)
source.to_hash
- 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 human_readable_byte_value
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def human_readable_byte_value(bytes)
return nil if bytes.blank?
raise InvalidBytesError unless bytes.is_a?(Integer)
- 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 uploaded_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def uploaded_file(params, resource_name)
raise MissingFilePathError.new('File field missing path information') if HashUtils.dig(params, VCAP::CloudController::Constants::INVALID_NGINX_UPLOAD_PARAM)
file_path = nginx_uploaded_file(params, resource_name) || rack_temporary_file(params, resource_name)
return unless file_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 filter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def filter(message, dataset)
if message.requested?(:after_guid)
last_event = dataset.first(guid: message.after_guid[0])
invalid_after_guid! unless last_event
- 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 fill_unreported_instances_with_down_instances
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fill_unreported_instances_with_down_instances(reported_instances, process, flat:)
process.instances.times do |i|
next if reported_instances[i]
down_instance = { state: VCAP::CloudController::Diego::LRP_DOWN }
- 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"