Showing 558 of 2,662 total issues
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 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 registered
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.registered(app)
app.helpers VCAP::Helpers
app.not_found do
# sinatra wants to drive us through the not_found block for *every*
- 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 scoped_space_guids
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def scoped_space_guids(permitted_space_guids:, filtered_space_guids:)
return nil unless permitted_space_guids || filtered_space_guids
return filtered_space_guids & permitted_space_guids if filtered_space_guids && permitted_space_guids
return permitted_space_guids if permitted_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 compatible?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def compatible?
services.each do |service|
if service.route_service? && route_services_disabled?
incompatibility_errors.add("Service #{service.name} is declared to be a route service but support for route services is disabled.")
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 save_staging_result
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def save_staging_result(payload)
lifecycle_data = payload[:result][:lifecycle_metadata]
buildpack_key = nil
buildpack_url = nil
- 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"
Further reading
Method taken_names
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def taken_names(new_services_names)
clashing_names = []
clashing_services = service_broker.services_dataset.where(label: new_services_names)
clashing_services.each do |old_service|
new_service = services.detect { |ns| ns.name == old_service.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 parse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse
Query.uuid ||= SecureRandom.uuid
segments = []
query.each do |q|
- 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 num_cores
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def num_cores
if RUBY_PLATFORM.match?(/linux/)
`cat /proc/cpuinfo | grep processor | wc -l`.to_i
elsif RUBY_PLATFORM.match?(/darwin/)
`sysctl -n hw.ncpu`.strip.to_i
- 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('DockerDisabled') if process.docker? && FeatureFlag.disabled?(:diego_docker)
raise CloudController::Errors::ApiError.new_from_details('AppPackageInvalid', 'The app package hash is empty') if process.package_hash.blank?
- 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 message
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def message
return unless args && details
formatted_args = args.map do |arg|
(arg.is_a? Array) ? arg.map(&:to_s).join(', ') : arg.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 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 encode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def encode(value)
v = if value.is_a?(VCAP::CloudController::Presenters::V3::BasePresenter)
value.to_hash
else
value.as_json(options.dup)
- 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 run_delayed_job
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run_delayed_job
Delayed::Worker.new.work_off if Delayed::Job.last
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 make_preflight_request_with_origin
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def make_preflight_request_with_origin(origin, method=nil, extra_headers={})
headers = {}
headers = headers.merge({ 'Origin' => origin })
headers = headers.merge({ 'Access-Control-Request-Method' => method }) unless method.nil?
headers = headers.merge(extra_headers)
- 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 make_preflight_request_with_origin
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def make_preflight_request_with_origin(origin, method=nil, extra_headers={})
headers = {}
headers = headers.merge({ 'Origin' => origin })
headers = headers.merge({ 'Access-Control-Request-Method' => method }) unless method.nil?
headers = headers.merge(extra_headers)
- 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 env_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def env_for(uri, env)
params = env[:params]
new_env = orig_env_for(uri, env)
if %w[GET DELETE].include?(env[:method])
- 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"