sanger/sequencescape

View on GitHub

Showing 283 of 5,433 total issues

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 ...
Severity: Minor
Found in app/models/study_report/study_details.rb - About 1 hr to fix

    Method perform_pick has 44 lines of code (exceeds 25 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 = []
    Severity: Minor
    Found in app/models/cherrypick_task.rb - About 1 hr to fix

      Method render_class_for_model has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def render_class_for_model(model) # rubocop:todo Metrics/CyclomaticComplexity
            render_class = Class.new(self)
      
            # NOTE: It's quite annoying that you don't have any access to the inheritable class attributes from
            # within the Class.new block above, so we have to do a separate instance_eval to get it to work.
      Severity: Minor
      Found in app/models/api/base.rb - About 1 hr 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 record_tube_samples has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      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|

      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 generate_picking_data_hash has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        def generate_picking_data_hash(target_barcode, requests: requests_for_destination_plate)
          data_objects = {}
          source_barcode_to_pick_number = {}
      
          current_pick_size = lambda { data_objects[data_objects.size]['source'].size }
      Severity: Minor
      Found in app/models/robot/pick_data.rb - About 1 hr 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 create_request_chain! has 43 lines of code (exceeds 25 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
      
      
      Severity: Minor
      Found in app/models/submission/linear_request_graph.rb - About 1 hr to fix

        Method process has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def process # rubocop:todo Metrics/CyclomaticComplexity
            # Store the details of the successful submissions so the user can be presented with a summary
            @submission_ids = []
            @completed_submissions = {}
        
        
        Severity: Minor
        Found in app/models/bulk_submission.rb - About 1 hr to fix

          Method _check_mandatory_field has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

                  def _check_mandatory_field(mandatory_field) # rubocop:todo Metrics/CyclomaticComplexity, Metrics/AbcSize
                    return unless upload.respond_to?(:rows)
                    upload.rows.each do |row|
                      next if row.columns.blank? || row.data.blank?
                      col_num = row.columns.find_column_or_null(:name, mandatory_field).number

          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 non_matching_retention_instructions_for_plates has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

                  def non_matching_retention_instructions_for_plates
                    return nil, nil unless upload.respond_to?(:rows)
          
                    # Initialize empty retention_instructions hash to store retention instructions
                    upload

          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 serialize has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.serialize(st) # rubocop:todo Metrics/CyclomaticComplexity
              attributes = st.attributes
              new_attributes = {}
          
              STRAIGHT_CLONE.each do |key|
          Severity: Minor
          Found in lib/submission_serializer.rb - About 1 hr 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 duplicate_barcodes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

                  def duplicate_barcodes # rubocop:todo Metrics/CyclomaticComplexity
                    return unless upload.respond_to?(:rows)
          
                    unique_bcs = []
                    upload.rows.each do |row|

          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 non_matching_retention_instructions has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

                  def non_matching_retention_instructions
                    return nil, nil unless upload.respond_to?(:rows)
          
                    upload
                      .rows

          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 39 lines of code (exceeds 25 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 =
          Severity: Minor
          Found in app/models/batch.rb - About 1 hr to fix

            Method included has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def self.included(base) # rubocop:todo Metrics/MethodLength
                  base.class_eval do
                    def mx_library
                      asset.external_identifier || 'UNKNOWN'
                    end
            Severity: Minor
            Found in app/models/api/messages/flowcell_io.rb - About 1 hr to fix

              Function exports has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function (api) {
                var validEnv = ["development", "test", "production"];
                var currentEnv = api.env();
                var isDevelopmentEnv = api.env("development");
                var isProductionEnv = api.env("production");
              Severity: Minor
              Found in babel.config.js - About 1 hr to fix

                Method included has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def self.included(base) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
                    base.class_eval do
                      ## State machine
                      ## namespace: true as destroyed clashes with rails, but we can't easily rename the state
                      aasm column: :state, whiny_persistence: true, namespace: true, name: 'qc_state' do
                Severity: Minor
                Found in app/models/qcable/statemachine.rb - About 1 hr to fix

                  Method build_association has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def build_association(as_class, options) # rubocop:todo Metrics/MethodLength
                      # First we build the association into the current ActiveRecord::Base class
                      as_name = as_class.name.demodulize.underscore
                      association_name = "#{as_name}_metadata".underscore.to_sym
                      class_name = "#{name}::Metadata"
                  Severity: Minor
                  Found in app/models/metadata.rb - About 1 hr to fix

                    Method validate_each has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def validate_each(record, attribute, value)
                        return unless check_hash(record, attribute, value)
                    
                        value.each do |program, params|
                          record.errors.add attribute, "invalid label #{program}" unless program.in?(PROGRAMS_LABELS)
                    Severity: Minor
                    Found in app/models/concerns/programs_validator.rb - About 1 hr 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

                    Function plateBarcodeScan has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                      plateBarcodeScan: async ({ commit, dispatch, state }, plate_barcode) => {
                        // Firstly we record that the plate has been scanned.
                        commit("scanPlate", { barcode: plate_barcode });
                        const scanned_plate_id = state.scanStore[`_${plate_barcode}`].id;
                    
                    
                    Severity: Minor
                    Found in app/frontend/plate-picks/store/actions.js - About 1 hr 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 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?
                    
                            # if this tube's list of barcodes already contains a foreign barcode with the same format then update the
                            # existing one

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language