Method filter_barcode_to_plate_index
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def filter_barcode_to_plate_index(destinations)
destinations.each_with_object({}) do |(destination_barcode, destination_info), all_barcodes|
mapping_sorted = sort_mapping_by_destination_well(destination_barcode, destination_info['mapping'])
mapping_sorted.each do |map_well|
barcode, _well = map_well['src_well']
- 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_submission?
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def valid_submission?(params) # rubocop:todo Metrics/CyclomaticComplexity
destination_plate_barcode = params[:barcodes][:destination_plate_barcode]
batch = Batch.find_by(id: params[:batch_id])
robot = Robot.find_by(id: params[:robot_id])
user = User.find_by(id: params[:user_id])
Method valid_submission?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def valid_submission?(params) # rubocop:todo Metrics/CyclomaticComplexity
destination_plate_barcode = params[:barcodes][:destination_plate_barcode]
batch = Batch.find_by(id: params[:batch_id])
robot = Robot.find_by(id: params[:robot_id])
user = User.find_by(id: params[:user_id])
- 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_plates_on_robot?
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def valid_plates_on_robot?(beds, plates, bed_prefix, robot, _batch, expected_plate_layout)
Method valid_destination_plates_on_robot?
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def valid_destination_plates_on_robot?(beds, plates, robot, batch, all_expected_plate_layout)
Method valid_source_plates_on_robot?
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def valid_source_plates_on_robot?(beds, plates, robot, batch, all_expected_plate_layout)
Method validate_barcode_params
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_barcode_params(barcode_hash) # rubocop:todo Metrics/CyclomaticComplexity
return yield('No barcodes specified') if barcode_hash.nil?
if barcode_hash[:batch_barcode].blank? || !Batch.valid_barcode?(barcode_hash[:batch_barcode])
yield('Worksheet barcode invalid')
- 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_plates_on_robot?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def valid_plates_on_robot?(beds, plates, bed_prefix, robot, _batch, expected_plate_layout)
# rubocop:enable Metrics/ParameterLists
return false if expected_plate_layout.blank?
expected_plate_layout.each do |plate_barcode, sort_number|
- 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"