sanger/sequencescape

View on GitHub

Showing 281 of 5,426 total issues

Class Batch has 55 methods (exceeds 20 allowed). Consider refactoring.
Open

class Batch < ApplicationRecord # rubocop:todo Metrics/ClassLength
  include Api::BatchIO::Extensions
  include Api::Messages::FlowcellIO::Extensions
  include AASM
  include SequencingQcBatch
Severity: Major
Found in app/models/batch.rb - About 7 hrs to fix

    Class Plate has 51 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Plate < Labware # rubocop:todo Metrics/ClassLength
      include Api::PlateIO::Extensions
      include ModelExtensions::Plate
      include Transfer::Associations
      include Transfer::State::PlateState
    Severity: Major
    Found in app/models/plate.rb - About 7 hrs to fix

      File batch.rb has 416 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'timeout'
      require 'aasm'
      
      # A {Batch} groups 1 or more {Request requests} together to enable processing in a
      # {Pipeline}. All requests in a batch get usually processed together, although it is
      Severity: Minor
      Found in app/models/batch.rb - About 6 hrs to fix

        Class Request has 43 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Request < ApplicationRecord # rubocop:todo Metrics/ClassLength
          # Include
          include ModelExtensions::Request
          include Aliquot::DeprecatedBehaviours::Request
          include Api::RequestIO::Extensions
        Severity: Minor
        Found in app/models/request.rb - About 5 hrs to fix

          File study.rb has 396 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'aasm'
          
          # A Study is a collection of various {Sample samples} and the work done on them.
          # They are perhaps slightly overloaded, and provide:
          # - A means of grouping together samples for administrative purposes
          Severity: Minor
          Found in app/models/study.rb - About 5 hrs to fix

            File request.rb has 392 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'aasm'
            
            # A Request represents work which needs to be done, either to fulfil a customers
            # needs {CustomerRequest} or for internal reasons {SystemRequest}.
            # The progress of a request is tracked through its {Request::Statemachine state machine}.
            Severity: Minor
            Found in app/models/request.rb - About 5 hrs to fix

              File sample.rb has 386 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'rexml/text'
              
              #
              # A {Sample} is an abstract concept, with represents the life of a sample of DNA/RNA
              # as it moves through our processes. As a result, a sample may exist in multiple
              Severity: Minor
              Found in app/models/sample.rb - About 5 hrs to fix

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

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

                    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
                    
                    
                    Severity: Minor
                    Found in app/models/submission/linear_request_graph.rb - About 4 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

                    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!
                    Severity: Minor
                    Found in app/controllers/batches_controller.rb - About 4 hrs to fix

                      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)
                      Severity: Minor
                      Found in lib/authenticated_system.rb - About 4 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 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]
                      
                      
                      Severity: Minor
                      Found in app/models/tasks/cherrypick_handler.rb - About 4 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

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

                        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 = {}

                        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 StudiesController has 31 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class StudiesController < ApplicationController
                          # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour.
                          # It should be removed wherever possible and the correct Strong  Parameter options applied in its place.
                          before_action :evil_parameter_hack!
                          include REXML
                        Severity: Minor
                        Found in app/controllers/studies_controller.rb - About 3 hrs to fix

                          Class Row has 31 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                              class Row # rubocop:todo Metrics/ClassLength
                                include ActiveModel::Model
                                include Converters
                          
                                attr_accessor :number, :data, :columns, :cache
                          Severity: Minor
                          Found in app/sample_manifest_excel/sample_manifest_excel/upload/row.rb - About 3 hrs to fix

                            Class TestWorksheet has 31 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                                class TestWorksheet < SequencescapeExcel::Worksheet::Base # rubocop:todo Metrics/ClassLength
                                  include SequencescapeExcel::Helpers::Worksheet
                            
                                  self.worksheet_name = 'DNA Collections Form'
                            
                            

                              File bulk_submission.rb has 325 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              module ArrayWithFieldList
                                refine Array do
                                  def comma_separate_field_list_for_display(*fields)
                                    field_list(*fields).join(', ')
                                  end
                              Severity: Minor
                              Found in app/models/bulk_submission.rb - About 3 hrs to fix

                                File batches_controller.rb has 325 lines of code (exceeds 250 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!
                                Severity: Minor
                                Found in app/controllers/batches_controller.rb - About 3 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language