Showing 5,430 of 5,432 total issues
Complex method Submission::SubmissionCreator#save (50.3) Open
def save # rubocop:todo Metrics/AbcSize
begin
ActiveRecord::Base.transaction do
# Add assets to the order...
new_order = create_order.tap { |o| o.update!(order_assets) }
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method Batch::StateMachineBehaviour::included (50.3) 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
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method SampleManifestExcel::Worksheet::TestWorksheet#record_tube_samples (50.0) Open
def record_tube_samples # rubocop:todo Metrics/AbcSize
tube_counter = 0
first_to_last.each do |sheet_row|
row = dynamic_attributes[sheet_row]
build_tube_sample_manifest_asset do |sample_manifest_asset|
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method CherrypickTask#perform_pick (49.8) 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
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method PlatePicksController#batches (49.3) Open
def batches # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
batch = Batch.find(params[:id])
# Either we're not a cherrypick batch, or we haven't been processed
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method SamplesController#taxon_lookup (49.2) Open
def taxon_lookup # rubocop:todo Metrics/AbcSize
if params[:term]
url = configatron.taxon_lookup_url + "/esearch.fcgi?db=taxonomy&term=#{params[:term].gsub(/\s/, '_')}"
elsif params[:id]
url = configatron.taxon_lookup_url + "/efetch.fcgi?db=taxonomy&mode=xml&id=#{params[:id]}"
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Method submit
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def submit(user, *accessionables) # rubocop:todo Metrics/CyclomaticComplexity
ActiveRecord::Base.transaction do
submission = Accessionable::Submission.new(self, user, *accessionables)
errors = submission.all_accessionables.map(&:errors).flatten
- 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
Complex method Api::Base::with_nested_has_many_association (48.3) Open
def self.with_nested_has_many_association(association, options = {}, &block) # rubocop:todo Metrics/AbcSize
association_helper = Class.new(Api::Base)
association_helper.class_eval(&block)
association_helper.singleton_class.class_eval do
define_method(:association) { association }
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method Admin::StudiesController#managed_update (48.2) Open
def managed_update # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
@study = Study.find(params[:id])
if params[:study][:uploaded_data].present?
Document.create!(documentable: @study, uploaded_data: params[:study][:uploaded_data])
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method SampleManifestExcel::Worksheet::TestWorksheet#add_cell_data (48.1) Open
def add_cell_data(column, row_num, partial) # rubocop:todo Metrics/CyclomaticComplexity
if partial && empty_row?(row_num)
(data[column.name] || dynamic_attributes[row_num][column.name]) unless empty_columns.include?(column.name)
elsif validation_errors.include?(:insert_size_from) && column.name == 'insert_size_from' &&
row_num == computed_first_row
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Class User
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ApplicationRecord # rubocop:todo Metrics/ClassLength
include Authentication
extend EventfulRecord
include Uuid::Uuidable
include Swipecardable
Complex method RequestsController#index (47.9) Open
def index # rubocop:todo Metrics/CyclomaticComplexity, Metrics/MethodLength
@study, @item = nil, nil
# Ok, here we pick the initial source for the Requests. They either come from Request (as in all Requests), or they
# are limited by the Asset / Item.
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Method prepare_order
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
def prepare_order(details) # rubocop:todo Metrics/CyclomaticComplexity
# Retrieve common attributes
study = Study.find_by_id_or_name!(details['study id'], details['study name'])
project = Project.find_by_id_or_name!(details['project id'], details['project name'])
user = User.find_by(login: details['user login']) or
Method walk_wells
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def walk_wells # rubocop:todo Metrics/CyclomaticComplexity
# Adjust each of the groups so that any wells that are in the same pool as those at the same position
# in the group to the left are moved to a non-clashing position. Effectively this makes the view of the
# plate slightly jagged.
group_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
Complex method Accessionable::Study#xml (46.9) Open
def xml # rubocop:todo Metrics/AbcSize
xml = Builder::XmlMarkup.new
xml.instruct!
xml.STUDY_SET('xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance') do
xml.STUDY(alias: self.alias, accession: accession_number) do
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method Plate::Creator#create_child_plates_from (46.6) Open
def create_child_plates_from(plate, current_user, creator_parameters) # rubocop:todo Metrics/AbcSize
stock_well_picker = plate.plate_purpose.stock_plate? ? ->(w) { [w] } : ->(w) { w.stock_wells }
parent_wells = plate.wells
parent_barcode = plate.human_barcode
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method namespace(report)::task#purposes (46.4) Open
task purposes: :environment do
Purpose.descendants.each do |klass|
puts '=' * 80
puts klass.name
puts '-' * 80
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Class BulkSubmission
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class BulkSubmission # rubocop:todo Metrics/ClassLength
# Activates the ArrayWithFieldList refinements for this class
using ArrayWithFieldList
# This is the default output from excel
Class Basic
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class ProductCriteria::Basic
SUPPORTED_WELL_ATTRIBUTES = %i[
gel_pass
concentration
rin
Class Attribute
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Attribute # rubocop:todo Metrics/ClassLength
attr_reader :name, :default
alias assignable_attribute_name name