Showing 283 of 5,433 total issues
Method construct!
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.construct!(hash) # rubocop:todo Metrics/CyclomaticComplexity
st = {}
STRAIGHT_CLONE.each { |key| st[key.to_sym] = hash[key.to_sym] }
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
def update(_attributes = {}) # rubocop:todo Metrics/CyclomaticComplexity, Metrics/MethodLength
return unless valid? && foreign_barcode_format.present?
# checking if the plate this well belongs to already has this foreign barcode set in its list of barcodes.
# or if it contains a foreign barcode with the same format, then update that existing one
- 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 apply_fluidigm_data
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def apply_fluidigm_data(fluidigm_file) # rubocop:todo Metrics/AbcSize
qc_assay = QcAssay.new
raise FluidigmError, 'File does not match plate' unless fluidigm_file.for_plate?(fluidigm_barcode)
wells
Method configure
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def configure(model) # rubocop:todo Metrics/CyclomaticComplexity
conditions = @options.slice(:if, :on)
save_blank_value = @options.delete(:save_blank)
allow_blank = save_blank_value
model.with_options(conditions) do |object|
Method show_summary
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show_summary # rubocop:todo Metrics/CyclomaticComplexity
page_params = { page: params[:page] || 1, per_page: params[:per_page] || 50 }
if request.xhr?
@summary = params[:summary] || 'assets-progress'
Method submission_structure
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def submission_structure # rubocop:todo Metrics/CyclomaticComplexity
Hash
.new { |h, i| h[i] = Array.new }
.tap do |submission|
csv_data_rows.each_with_index do |row, index|
Method stage
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def stage # rubocop:todo Metrics/CyclomaticComplexity
@workflow = Workflow.includes(:tasks).find(params[:workflow_id])
@stage = params[:id].to_i
@task = @workflow.tasks[@stage]
Method progress_report_header
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def progress_report_header
[
'Status',
'Study',
'Supplier',
Method well_to_destination
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def well_to_destination # rubocop:todo Metrics/AbcSize
{}.tap do |sources_to_target|
# Group the wells based on the submission
groups = source.wells.in_column_major_order.with_pool_id.group_by(&:pool_id).delete_if { |k, _| k.nil? }.values
- 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 swap
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def swap(current_user, batch_info = {}) # rubocop:todo Metrics/CyclomaticComplexity
return false if batch_info.empty?
# Find the two lanes that are to be swapped
batch_request_left =
- 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
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 output_aliquot
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def output_aliquot(xml, aliquot) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
xml.sample(
sample_id: aliquot.sample_id,
library_id: aliquot.library_id,
library_name: aliquot.library_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 perform_pick
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def perform_pick(requests, robot, control_source_plate, workflow_controller) # rubocop:todo Metrics/AbcSize
max_plates = robot.max_beds
raise StandardError, 'The chosen robot has no beds!' if max_plates.zero?
destination_plates = []
- 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 file_addition
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def file_addition(action, http_method) # rubocop:todo Metrics/AbcSize
send(
http_method,
%r{/([\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12})(?:/([^/]+(?:/[^/]+)*))?},
file_attached: true
Method create_request
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_request # rubocop:todo Metrics/AbcSize
@request_type = RequestType.find(params[:request_type_id])
@study = Study.find(params[:study_id]) if params[:cross_study_request].blank?
@project = Project.find(params[:project_id]) if params[:cross_project_request].blank?
Method studies_from_scope
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def studies_from_scope(scope) # rubocop:todo Metrics/CyclomaticComplexity
studies =
case scope
when 'interesting'
Study.of_interest_to(current_user)
Method included
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included(base) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
base.class_eval do
include AASM
aasm column: :state, whiny_persistence: true do
state :pending, initial: true
Method generate_tecan_data
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_tecan_data # rubocop:todo Metrics/AbcSize
source_barcode = "#{plate.machine_barcode}_s"
destination_barcode = "#{plate.machine_barcode}_d"
data_object = {
'user' => user.login,
Method grant_privileges
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def grant_privileges # rubocop:todo Metrics/AbcSize
Rails.logger.debug { 'Granting Administrator privileges' }
# Labware
can %i[edit rename change_purpose edit_retention_instruction], Labware
Method check_inputs_to_volume_to_cherrypick_by_nano_grams!
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_inputs_to_volume_to_cherrypick_by_nano_grams!(minimum_volume, maximum_volume, target_ng, source_well)
raise 'Source well not found' if source_well.nil?
if minimum_volume.blank? || minimum_volume <= 0.0
raise Cherrypick::VolumeError,