sanger/sequencescape

View on GitHub

Showing 281 of 5,426 total issues

Method prepare_order has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  def prepare_order(details) # rubocop:todo Metrics/CyclomaticComplexity
    # Retrieve common attributes
    study = Study.find_by_id_or_name!(details['study id'], details['study name'])
    project = Project.find_by_id_or_name!(details['project id'], details['project name'])
    user = User.find_by(login: details['user login']) or
Severity: Minor
Found in app/models/bulk_submission.rb - About 3 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

File plate.rb has 320 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'lab_where_client'

# https://github.com/sanger/sequencescape/raw/master/docs/images/plate.jpg
#
# A plate is a piece of labware made up of a number of {Well wells}. This class represents the physical piece of
Severity: Minor
Found in app/models/plate.rb - About 3 hrs to fix

    Method do_cherrypick_task has 92 lines of code (exceeds 25 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: Major
    Found in app/models/tasks/cherrypick_handler.rb - About 3 hrs to fix

      Class Receptacle has 30 methods (exceeds 20 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 3 hrs to fix

        Method process has a Cognitive Complexity of 24 (exceeds 5 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 3 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

        File studies_controller.rb has 306 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'rexml/document'
        
        # rubocop:todo Metrics/ClassLength
        class StudiesController < ApplicationController
          # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour.
        Severity: Minor
        Found in app/controllers/studies_controller.rb - About 3 hrs to fix

          Class SubmissionCreator has 28 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class Submission::SubmissionCreator < Submission::PresenterSkeleton # rubocop:todo Metrics/ClassLength
            SubmissionsCreaterError = Class.new(StandardError)
            IncorrectParamsException = Class.new(SubmissionsCreaterError)
            InvalidInputException = Class.new(SubmissionsCreaterError)
          
          
          Severity: Minor
          Found in app/models/submission/submission_creator.rb - About 3 hrs to fix

            Class Well has 27 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Well < Receptacle # rubocop:todo Metrics/ClassLength
              include Api::WellIO::Extensions
              include ModelExtensions::Well
              include Cherrypick::VolumeByNanoGrams
              include Cherrypick::VolumeByNanoGramsPerMicroLitre
            Severity: Minor
            Found in app/models/well.rb - About 3 hrs to fix

              Method configure has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              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|
              Severity: Minor
              Found in app/models/attributable/attribute.rb - About 3 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 Submission has 26 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class Submission < ApplicationRecord # rubocop:todo Metrics/ClassLength
                include Uuid::Uuidable
                extend Submission::StateMachine
                include Submission::DelayedJobBehaviour
                include ModelExtensions::Submission
              Severity: Minor
              Found in app/models/submission.rb - About 3 hrs to fix

                Class Labware has 26 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Labware < Asset
                  include Commentable
                  include Uuid::Uuidable
                  include AssetLink::Associations
                  include SharedBehaviour::Named
                Severity: Minor
                Found in app/models/labware.rb - About 3 hrs to fix

                  Method generate_json_to_object_mapping has a Cognitive Complexity of 21 (exceeds 5 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.
                  Severity: Minor
                  Found in app/api/core/io/base/json_formatting_behaviour/input.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 a Cognitive Complexity of 20 (exceeds 5 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: Minor
                  Found in app/models/accession_service.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

                  Class User has 24 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class User < ApplicationRecord # rubocop:todo Metrics/ClassLength
                    include Authentication
                    extend EventfulRecord
                    include Uuid::Uuidable
                    include Swipecardable
                  Severity: Minor
                  Found in app/models/user.rb - About 2 hrs to fix

                    Method prepare_order has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def prepare_order(details) # rubocop:todo Metrics/CyclomaticComplexity
                        # Retrieve common attributes
                        study = Study.find_by_id_or_name!(details['study id'], details['study name'])
                        project = Project.find_by_id_or_name!(details['project id'], details['project name'])
                        user = User.find_by(login: details['user login']) or
                    Severity: Major
                    Found in app/models/bulk_submission.rb - About 2 hrs to fix

                      Method walk_wells has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def walk_wells # rubocop:todo Metrics/CyclomaticComplexity
                          # Adjust each of the groups so that any wells that are in the same pool as those at the same position
                          # in the group to the left are moved to a non-clashing position.  Effectively this makes the view of the
                          # plate slightly jagged.
                          group_size =
                      Severity: Minor
                      Found in app/models/tag_layout/walk_wells_by_pools.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

                      Class Basic has 23 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class ProductCriteria::Basic
                        SUPPORTED_WELL_ATTRIBUTES = %i[
                          gel_pass
                          concentration
                          rin
                      Severity: Minor
                      Found in app/models/product_criteria/basic.rb - About 2 hrs to fix

                        Class Attribute has 23 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                          class Attribute # rubocop:todo Metrics/ClassLength
                            attr_reader :name, :default
                        
                            alias assignable_attribute_name name
                        
                        
                        Severity: Minor
                        Found in app/models/attributable/attribute.rb - About 2 hrs to fix

                          Class BulkSubmission has 23 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class BulkSubmission # rubocop:todo Metrics/ClassLength
                            # Activates the ArrayWithFieldList refinements for this class
                            using ArrayWithFieldList
                          
                            # This is the default output from excel
                          Severity: Minor
                          Found in app/models/bulk_submission.rb - About 2 hrs to fix

                            File test_worksheet.rb has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            require_dependency 'sample_manifest_excel/tags'
                            
                            module SampleManifestExcel
                              module Worksheet
                                ##
                              Severity
                              Category
                              Status
                              Source
                              Language