app/models/robot/pick_data.rb
Method generate_picking_data_hash
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
def generate_picking_data_hash(target_barcode, requests: requests_for_destination_plate)
data_objects = {}
source_barcode_to_pick_number = {}
current_pick_size = lambda { data_objects[data_objects.size]['source'].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 sorted_requests_for_destination_plate
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def sorted_requests_for_destination_plate(requests_to_sort) # rubocop:todo Metrics/CyclomaticComplexity
requests_to_sort.sort_by do |req|
if req.target_asset&.map&.column_order
[req.target_asset.plate.id, req.asset.plate&.pick_as_control? ? 0 : 1, req.target_asset.map.column_order]
else
- 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_picking_data_hash
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def generate_picking_data_hash(target_barcode, requests: requests_for_destination_plate)
data_objects = {}
source_barcode_to_pick_number = {}
current_pick_size = lambda { data_objects[data_objects.size]['source'].size }