Showing 281 of 5,426 total issues
Method generate_json_to_object_mapping
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_json_to_object_mapping(json_to_attribute) # rubocop:todo Metrics/CyclomaticComplexity
code = []
# Split the mappings into two to make things easier. Read only attributes are easily
# handled right now, provided there is not a read_write one that shares their name.
File well.rb
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Well < Receptacle # rubocop:todo Metrics/ClassLength
include Api::WellIO::Extensions
include ModelExtensions::Well
include Cherrypick::VolumeByNanoGrams
include Cherrypick::VolumeByNanoGramsPerMicroLitre
Method stage
has a Cognitive Complexity of 18 (exceeds 5 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]
- 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
Class SampleManifest
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class SampleManifest < ApplicationRecord # rubocop:todo Metrics/ClassLength
include Uuid::Uuidable
include ModelExtensions::SampleManifest
include SampleManifest::BarcodePrinterBehaviour
include SampleManifest::CoreBehaviour
Class Base
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Base
MANDATORY_FIELDS = %w[country_of_origin date_of_sample_collection].freeze
include ActiveModel::Model
include SequencescapeExcel::SubclassChecker
Method render_cherrypick_task
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def render_cherrypick_task(_task, params) # rubocop:todo Metrics/CyclomaticComplexity
if flash[:error].present?
redirect_to action: 'stage', batch_id: @batch.id, workflow_id: @workflow.id, id: (@stage - 1).to_s
return
end
- 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
File submissions.js
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Submission workflow jQuery Plugin...
(function (window, $) {
"use strict";
var methods = {
Class Aliquot
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Aliquot < ApplicationRecord # rubocop:todo Metrics/ClassLength
include Uuid::Uuidable
include Api::Messages::FlowcellIO::AliquotExtensions
include Api::Messages::QcResultIO::AliquotExtensions
include AliquotIndexer::AliquotScopes
Class Pooling
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Pooling # rubocop:todo Metrics/ClassLength
include ActiveModel::Model
attr_writer :barcodes, :source_assets
attr_accessor :stock_mx_tube_required, :stock_mx_tube, :standard_mx_tube, :barcode_printer, :count
Class Pipeline
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Pipeline < ApplicationRecord # rubocop:todo Metrics/ClassLength
include Uuid::Uuidable
include Pipeline::BatchValidation
include SharedBehaviour::Named
Method default_permitted_metadata_fields
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def default_permitted_metadata_fields
{
sample_metadata_attributes: %i[
consent_withdrawn
organism
Method included
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.included(base) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
base.class_eval do
# We probably want to move this validation
validates_each(:project, if: :checking_project?) do |record, _attr, project|
record.errors.add(:base, "Project #{project.name} is not approved") unless project.approved?
- 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 submit
has 52 lines of code (exceeds 25 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
File receptacle.rb
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Receptacle < Asset # rubocop:todo Metrics/ClassLength
include Uuid::Uuidable
include Commentable
include Transfer::State
include Aliquot::Remover
Method sample_named
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sample_named(name, study)
{
'sample_tube_attributes' => {
'two_dimensional_barcode' => ''
},
Method render_cherrypick_task
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_cherrypick_task(_task, params) # rubocop:todo Metrics/CyclomaticComplexity
if flash[:error].present?
redirect_to action: 'stage', batch_id: @batch.id, workflow_id: @workflow.id, id: (@stage - 1).to_s
return
end
Function addOrderHandler
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
var addOrderHandler = function (_event) {
// Loads this order's parameters into thewindow.SCAPE.submission object...
$("#order-parameters")
.find("select, input")
.each(function () {
Method included
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included(base) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
base.class_eval do
def mx_library
asset.external_identifier
end
Method handle_has_many
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def handle_has_many(attributes, attribute, json, object) # rubocop:todo Metrics/CyclomaticComplexity
if json.first.is_a?(Hash)
uuids = Uuid.include_resource.lookup_many_uuids(json.filter_map { |j| j['uuid'] })
uuid_to_resource = uuids.each_with_object({}) { |uuid, hash| hash[uuid.external_id] = uuid.resource }
mapped_attributes =
- 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 progress_report_on_all_assets
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def progress_report_on_all_assets # rubocop:todo Metrics/AbcSize
yield(progress_report_header)
each_stock_well_id_in_study_in_batches do |asset_ids|
# eager loading of well_attribute , can only be done on wells ...