Showing 583 of 2,698 total issues
Method threaded_start
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def threaded_start
self.class.lifecycle.run_callbacks(:execute, self) do
loop do
self.class.lifecycle.run_callbacks(:loop, self) do
@realtime = Benchmark.realtime do
- 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 number_of_starting_and_running_instances_for_process
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def number_of_starting_and_running_instances_for_process(process)
return 0 unless process.started?
running_indices = Set.new
bbs_instances_client.lrp_instances(process).each do |actual_lrp|
- 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 install
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def install(buildpacks)
return unless buildpacks
CloudController::DependencyLocator.instance.buildpack_blobstore.ensure_bucket_exists
job_factory = VCAP::CloudController::Jobs::Runtime::BuildpackInstallerFactory.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 add_column_missing_name?
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def add_column_missing_name?(opts)
return true if opts.type == :sym && %i[index primary_key unique].include?(sym_opts_name(opts))
needs_named_index = false
needs_named_primary_key = false
- 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 start_cc
has a Cognitive Complexity of 14 (exceeds 5 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)
- 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 generate_diff
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_diff(app_manifests, space)
json_diff = []
recognized_top_level_keys = AppManifestMessage.allowed_keys.map(&:to_s).map(&:dasherize)
Function name
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn[ name ] = function( options ) {
var isMethodCall = typeof options === "string",
args = widget_slice.call( arguments, 1 ),
returnValue = this;
Method extract_table_of_contents
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def extract_table_of_contents(html)
page = Nokogiri::HTML(html)
headings = []
page.css('h1,h2,h3').each do |heading|
Method to_hash
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_hash
{
guid: usage_event.guid,
created_at: usage_event.created_at,
updated_at: usage_event.created_at,
Method create
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
message = BuildCreateMessage.new(Oj.load(request.body))
unprocessable!(message.errors.full_messages) unless message.valid?
package = PackageModel.where(guid: message.package_guid).
Method build_eager_load_hash
has 41 lines of code (exceeds 25 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
Method to_hash
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_hash
app_name = @process.name
if @process.is_a?(VCAP::CloudController::AppModel)
uris = @process.routes.map(&:uri)
Method entity_hash
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def entity_hash(controller, process, opts, depth, parents, orphans=nil)
entity = {
'name' => process.name,
'production' => process.production,
'space_guid' => process.space.guid,
Method cleanup
has a Cognitive Complexity of 13 (exceeds 5 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
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def update(package, message)
validate_package_state!(package)
validate_package_checksum!(package, message)
@logger.info("Updating package #{package.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 version_needs_to_be_updated?
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def version_needs_to_be_updated?
# change version if:
#
# * transitioning to STARTED
# * memory is changed
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def update(sidecar, message)
validate_memory_allocation!(message, sidecar) if message.requested?(:memory_in_mb) || message.requested?(:process_types)
sidecar.name = message.name if message.requested?(:name)
sidecar.command = message.command if message.requested?(:command)
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def update
message = VCAP::CloudController::UpdateEnvironmentVariablesMessage.for_env_var_group(hashed_params[:body])
unprocessable!(message.errors.full_messages) unless message.valid?
unauthorized! unless permission_queryer.can_write_globally?
- 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 checksum_validator
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def checksum_validator(checksum)
unless checksum.is_a?(Hash)
errors.add(:resources, "#{RESOURCE_ERROR_PREAMBLE} a non-object checksum") unless errors.added?(
:resources, "#{RESOURCE_ERROR_PREAMBLE} a non-object checksum"
)
- 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_from_file
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.extract_from_file(bits_file_path)
bits_file_path = bits_file_path.path if bits_file_path.respond_to?(:path)
Zip::File.open(bits_file_path) do |zip_file|
zip_file.each do |entry|
next unless entry.name == 'manifest.yml'
- 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"