Showing 556 of 2,660 total issues
Method define_message
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def define_message(type)
attrs = Array(attributes)
to_one = @to_one_relationships ||= []
to_many = @to_many_relationships ||= []
- 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 sync
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def sync
logger.info('run-task-sync')
@bump_freshness = true
diego_tasks = bbs_task_client.fetch_tasks.index_by(&:task_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 extract_table_of_contents
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def extract_table_of_contents(html)
page = Nokogiri::HTML(html)
headings = []
page.css('h1,h2,h3').each do |heading|
- 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 buildpack_installer_factory_spec.rb
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
module VCAP::CloudController
module Jobs::Runtime
RSpec.describe BuildpackInstallerFactory do
File app_create_message_spec.rb
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
require 'messages/app_create_message'
module VCAP::CloudController
RSpec.describe AppCreateMessage do
Method scale
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def scale
raise InvalidProcess.new('Cannot scale this process while a deployment is in flight.') if @process.web? && @process.app.deploying?
@process.db.transaction do
@process.app.lock!
- 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?
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def valid?
attributes.each do |attribute_name, details|
field = fields[attribute_name]
if field
@attributes_with_bad_default << [attribute_name, details[:default], field.default] unless details[:default] == field.default
- 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 list_message_spec.rb
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
require 'messages/list_message'
class VCAP::CloudController::ListMessage
register_allowed_keys []
File service_binding_create_message_spec.rb
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
require 'messages/service_binding_create_message'
module VCAP::CloudController
RSpec.describe ServiceBindingCreateMessage do
Method perform
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def perform
logger = Steno.logger('cc-background')
service_binding = ServiceBinding.first(guid: service_binding_guid)
return if service_binding.nil? # assume the binding has been purged
- 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 18 (exceeds 5 allowed). Consider refactoring. Open
def update(service_instance, message)
logger = Steno.logger('cc.action.user_provided_service_instance_update')
updates = {}
updates[: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 validate_destination_contents
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def validate_destination_contents
app_to_ports_hash = {}
destinations.each_with_index do |dst, index|
unless dst.is_a?(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 key_error
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def key_error
return MetadataError.error('key cannot be empty string') unless valid_key_presence?(key)
return MetadataError.error("key has more than one '/'") unless valid_key_format?
return MetadataError.error("prefix '#{prefix}' must be in valid dns format") unless valid_prefix_format?
return MetadataError.error("prefix '#{prefix[0...8]}...' is greater than #{MAX_METADATA_PREFIX_SIZE} characters") unless valid_prefix_size?
- 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_job
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def create_job(job_class)
params = job_class.instance_method(:initialize).parameters
args = []
kwargs = {}
block = 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
File quotas_apps_message_spec.rb
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
module VCAP::CloudController
RSpec.describe QuotasAppsMessage do
subject { QuotasAppsMessage.new(params) }
File registry_bits_packer_spec.rb
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
require 'cloud_controller/packager/registry_bits_packer'
module CloudController::Packager
RSpec.describe RegistryBitsPacker do
Class Updater
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Updater
attr_reader :deployment, :logger
def initialize(deployment, logger)
@deployment = deployment
File buildpack_bits_controller_spec.rb
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
## NOTICE: Prefer request specs over controller specs as per ADR #0003 ##
module VCAP::CloudController
File v3_error_hasher_spec.rb
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'lightweight_spec_helper'
require 'presenters/v3_error_hasher'
require 'cloud_controller/errors/api_error'
require 'cloud_controller/errors/not_authenticated'
require 'cloud_controller/errors/compound_error'
File cors_spec.rb
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
require 'cors'
module CloudFoundry
module Middleware