Showing 569 of 2,678 total issues
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
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 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)
Method filter
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def filter(message, dataset)
dataset = dataset.where(name: message.names) if message.requested?(:names)
dataset = dataset.where(space_guid: message.space_guids) if message.requested?(:space_guids)
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 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 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 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 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(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 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
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 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 crashed_instances_for_app
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def crashed_instances_for_app(process)
crashed_instances = []
bbs_instances_client.lrp_instances(process).each do |actual_lrp|
next unless actual_lrp.state == ::Diego::ActualLRPState::CRASHED
next unless actual_lrp.actual_lrp_key.index < process.instances
- 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"
Further reading
Method on_block
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def on_block(node)
node.each_descendant(:send) do |send_node|
method = method_name(send_node)
next unless constraint_adding_method?(method) || column_adding_method?(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"