sanger/sequencescape

View on GitHub

Showing 5,431 of 5,433 total issues

Complex method StudyReport::AssetDetails#qc_report (42.2)
Open

  def qc_report # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
    qc_data = { supplier_volume: 0 }

    sample = primary_aliquot.try(:sample)
    if sample.present?

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 Cherrypick::VolumeByNanoGrams#check_inputs_to_volume_to_cherrypick_by_nano_grams! (42.2)
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,

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 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

Severity: Minor
Found in app/models/pipeline.rb - About 2 hrs to fix

    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
    Severity: Minor
    Found in app/models/pooling.rb - About 2 hrs to fix

      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
      Severity: Minor
      Found in app/models/aliquot.rb - About 2 hrs to fix

        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
        Severity: Major
        Found in app/controllers/samples_controller.rb - About 2 hrs to fix

          Complex method ApplicationHelper#tabulated_error_messages_for (41.9)
          Open

            def tabulated_error_messages_for(*params) # rubocop:todo Metrics/AbcSize
              options = params.last.is_a?(Hash) ? params.pop.symbolize_keys : {}
              objects = params.filter_map { |object_name| instance_variable_get(:"@#{object_name}") }
              count = objects.inject(0) { |sum, object| sum + object.errors.count }
              if count.zero?
          Severity: Minor
          Found in app/helpers/application_helper.rb by flog

          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_plates (41.3)
          Open

            def create_plates(source_plate_barcodes, current_user, creator_parameters = nil) # rubocop:todo Metrics/AbcSize
              if source_plate_barcodes.blank?
                # No barcodes have been scanned. This results in empty plates. This behaviour
                # is used in a few circumstances. User comment:
                # bs6: we use it to create 'pico standard' barcodes, as well as 'aliquot' barcodes.
          Severity: Minor
          Found in app/models/plate/creator.rb by flog

          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 StudyReport::WellDetails#qc_report (41.2)
          Open

            def qc_report # rubocop:todo Metrics/AbcSize
              # well must be from a stock plate
              return {} unless plate.try(:stock_plate?)
          
              qc_data = super

          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 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?
          Severity: Minor
          Found in app/models/submission/project_validation.rb - About 2 hrs to fix

          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
          Severity: Major
          Found in app/models/accession_service.rb - About 2 hrs to fix

            Complex method Aliquot#matches? (40.8)
            Open

              def matches?(object) # rubocop:todo Metrics/CyclomaticComplexity
                # NOTE: This function is directional, and assumes that the downstream aliquot
                # is checking the upstream aliquot
                case
                when sample_id != object.sample_id
            Severity: Minor
            Found in app/models/aliquot.rb by flog

            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::has_many#construct! (40.6)
            Open

                def construct! # rubocop:todo Metrics/AbcSize
                  transaction do
                    plate = proxy_association.owner
                    plate
                      .maps
            Severity: Minor
            Found in app/models/plate.rb by flog

            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 BatchesController#standard_create (40.4)
            Open

              def standard_create(requests) # rubocop:todo Metrics/CyclomaticComplexity
                unless @pipeline.all_requests_from_submissions_selected?(requests)
                  return pipeline_error_on_batch_creation('All plates in a submission must be selected')
                end
                if @pipeline.max_size && requests.length > @pipeline.max_size
            Severity: Minor
            Found in app/controllers/batches_controller.rb by flog

            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

            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
            Severity: Minor
            Found in app/models/receptacle.rb - About 2 hrs to fix

              Complex method Submission::FlexibleRequestGraph::ChainLink#build! (40.0)
              Open

                  def build! # rubocop:todo Metrics/AbcSize
                    multiplier.times do |_|
                      # Now we can iterate over the source assets and target assets building the requests between them.
                      # Ensure that the request has the correct comments on it, and that the aliquots of the source asset
                      # are transferred into the destination if the request does not do this in some manner itself.

              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 sample_named has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def sample_named(name, study)
                    {
                      'sample_tube_attributes' => {
                        'two_dimensional_barcode' => ''
                      },
              Severity: Minor
              Found in lib/working_setup/standard_seeder.rb - About 2 hrs to fix

                Complex method Submission::ProjectValidation::included (39.8)
                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?

                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 QcReport::ReportBehaviour#generate_report (39.8)
                Open

                    def generate_report # rubocop:todo Metrics/AbcSize
                      begin
                        study.each_well_for_qc_report_in_batches(
                          exclude_existing,
                          product_criteria,
                Severity: Minor
                Found in app/models/qc_report.rb by flog

                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 BaitLibraryLayout#each_bait_library_assignment (39.7)
                Open

                  def each_bait_library_assignment # rubocop:todo Metrics/AbcSize
                    # We only accept the wells which have been pooled
                    plate
                      .wells
                      .with_pool_id
                Severity: Minor
                Found in app/models/bait_library_layout.rb by flog

                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

                Severity
                Category
                Status
                Source
                Language