Showing 5,424 of 5,426 total issues
Class Order
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
class Order < ApplicationRecord # rubocop:todo Metrics/ClassLength
# Ensure order methods behave correctly
AssetTypeError = Class.new(StandardError)
DEFAULT_ASSET_INPUT_METHODS = ['select an asset group'].freeze
Class Map
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
class Map < ApplicationRecord
validates :description, :asset_size, :location_id, :row_order, :column_order, :asset_shape, presence: true
validates :asset_size, :row_order, :column_order, numericality: true
# @!attribute description
Complex method BatchesHelper#output_aliquot (75.6) 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
- 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 WorkflowsController#stage (74.2) Open
def stage # rubocop:todo Metrics/CyclomaticComplexity
@workflow = Workflow.includes(:tasks).find(params[:workflow_id])
@stage = params[:id].to_i
@task = @workflow.tasks[@stage]
- 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 Api::EndpointHandler::file_model_addition (73.4) Open
def file_model_addition(action, http_method) # rubocop:todo Metrics/AbcSize
send(http_method, %r{/([^\d/][^/]+(?:/[^/]+){0,2})}, file_attached: true) do
if request.acceptable_media_types.prioritize(registered_mimetypes).present?
raise Core::Service::ContentFiltering::InvalidRequestedContentType
end
- 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 create_request_chain!
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def create_request_chain!(request_type_and_multiplier_pairs, source_data_set, multiplexing_assets, &block) # rubocop:todo Metrics/CyclomaticComplexity
raise StandardError, 'No request types specified!' if request_type_and_multiplier_pairs.empty?
request_type, multiplier = request_type_and_multiplier_pairs.shift
- 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 Admin::StudiesController#filter (72.6) Open
def filter # rubocop:todo Metrics/CyclomaticComplexity
filter_conditions = { approved: false } if params[:filter][:by] == 'not approved' unless params[:filter].nil?
if params[:filter][:by] == 'not approved' || params[:filter][:by] == 'all'
@studies = Study.where(filter_conditions).alphabetical.select { |p| p.name.include? params[:q] }
- 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 main#perform (72.6) Open
def perform
Submission.find(submission_id).build_batch
- 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 BatchesController
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
class BatchesController < ApplicationController # rubocop:todo Metrics/ClassLength
# WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behaviour.
# It should be removed wherever possible and the correct Strong Parameter options applied in its place.
before_action :evil_parameter_hack!
Complex method LabwareController#index (69.9) Open
def index # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
if params[:study_id]
@study = Study.find(params[:study_id])
@assets = @study.assets_through_aliquots.order(:name).page(params[:page])
else
- 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 login_required
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def login_required # rubocop:todo Metrics/CyclomaticComplexity
username, passwd = get_auth_data
if username && passwd
user = User.authenticate(username, passwd)
- 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 PlatesController#create (67.1) Open
def create # rubocop:todo Metrics/AbcSize
@creator = plate_creator = Plate::Creator.find(params[:plates][:creator_id])
barcode_printer = BarcodePrinter.find(params[:plates][:barcode_printer])
source_plate_barcodes = params[:plates][:source_plates]
create_asset_group = params[:plates][:create_asset_group] == 'Yes'
- 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 do_cherrypick_task
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def do_cherrypick_task(_task, params) # rubocop:todo Metrics/CyclomaticComplexity
plates = params[:plate]
size = params[:plate_size]
plate_type = params[:plate_type]
- 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::EndpointHandler::file_action (66.9) Open
def file_action(action, http_method) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
send(
http_method,
%r{/([\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12})(?:/([^/]+(?:/[^/]+)*))?},
file_requested: 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
Class Study
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class Study < ApplicationRecord # rubocop:todo Metrics/ClassLength
# It has to be here, as there are has_many through: :roles associations in modules
# Includes / Extendes
has_many :roles
Complex method Endpoints::Uuids::bind_action#create (64.8) Open
bind_action(:create, to: 'bulk', as: :bulk) do |_, request, response|
lookup = request.json.respond_to?(:keys) ? request.json['lookup'] : nil
uuids = Search.create_bulk!(lookup).map(&:find)
# Hack time ...
- 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 BulkSubmission#submission_structure (64.7) 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|
- 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 Attributable::Attribute#configure (63.5) 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|
- 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 duplicate_barcodes
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def duplicate_barcodes # rubocop:todo Metrics/CyclomaticComplexity
return nil, nil unless upload.respond_to?(:rows)
unique_bcs = {}
unique_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
Complex method SubmissionSerializer::serialize (62.1) Open
def self.serialize(st) # rubocop:todo Metrics/CyclomaticComplexity
attributes = st.attributes
new_attributes = {}
STRAIGHT_CLONE.each do |key|
- 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