sanger/limber

View on GitHub

Showing 87 of 187 total issues

File resources.js has 1217 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Auto-generated by Sequencescape on 2024-09-04 17:09:09 +0100"
 * Using develop-Y24-190@8b0e5a6
 * bundle exec rake devour:create_config"
 *
Severity: Major
Found in app/frontend/javascript/shared/resources.js - About 3 days to fix

    File customTaggedPlateTestData.js has 789 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const plateUuid = 'afabla7e-9498-42d6-964e-50f61ded6d9a'
    
    const exampleParent = {
      id: '1',
      uuid: plateUuid,

      Class PlateSplitToTubeRacks has 60 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class PlateSplitToTubeRacks < Base
          include LabwareCreators::CustomPage
          include SupportParent::PlateOnly
      
          self.page = 'plate_split_to_tube_racks'
      Severity: Major
      Found in app/models/labware_creators/plate_split_to_tube_racks.rb - About 1 day to fix

        Function sharedSpecs has 174 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const sharedSpecs = (args) => {
          const subject = args.subject
          const mockLocation = {}
        
          describe('a MultiStamp instance', () => {

          File plate_split_to_tube_racks.rb has 328 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require_dependency 'form'
          require_dependency 'labware_creators/base'
          
          module LabwareCreators
            # Handles the creation of up to 2 child racks of tubes from a single parent 96-well plate.
          Severity: Minor
          Found in app/models/labware_creators/plate_split_to_tube_racks.rb - About 3 hrs to fix

            Class StampedPlateAddingRandomisedControls has 30 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class StampedPlateAddingRandomisedControls < StampedPlate # rubocop:todo Metrics/ClassLength
                PARENT_PLATE_INCLUDES =
                  'wells.requests_as_source,wells.requests_as_source.request_type,' \
                    'wells.aliquots,wells.aliquots.sample,wells.aliquots.sample.sample_metadata'
            
            

              File multi_plate_pooling.js has 293 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import $ from 'jquery'
              import SCAPE from '@/javascript/lib/global_message_system.js'
              
              const WELLS_IN_COLUMN_MAJOR_ORDER = [
                'A1',
              Severity: Minor
              Found in app/frontend/entrypoints/pages/multi_plate_pooling.js - About 3 hrs to fix

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

                  class Robot
                    include Form
                
                    attr_reader :beds
                    attr_accessor :api, :user_uuid, :layout, :name, :id, :verify_robot, :class, :robot_barcode, :require_robot
                Severity: Minor
                Found in app/models/robots/robot.rb - About 2 hrs to fix

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

                  class Sequencescape::Api::V2::Plate < Sequencescape::Api::V2::Base
                    include WellHelpers::Extensions
                    include Sequencescape::Api::V2::Shared::HasRequests
                    include Sequencescape::Api::V2::Shared::HasPurpose
                    include Sequencescape::Api::V2::Shared::HasBarcode
                  Severity: Minor
                  Found in app/sequencescape/sequencescape/api/v2/plate.rb - About 2 hrs to fix

                    Class MultiStampTubesUsingTubeRackScan has 22 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                      class MultiStampTubesUsingTubeRackScan < Base
                        include LabwareCreators::CustomPage
                        include SupportParent::TubeOnly
                    
                        self.page = 'multi_stamp_tubes_using_tube_rack_scan'
                    Severity: Minor
                    Found in app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb - About 2 hrs to fix

                      Function commentStoreFactory has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const commentStoreFactory = function (axiosInstance, devourApi, assetId, userId) {
                        return {
                          comments: undefined,
                      
                          async refreshComments() {
                      Severity: Major
                      Found in app/frontend/javascript/asset-comments/comment-store.js - About 2 hrs to fix

                        Function mockApi has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const mockApi = function (resources = sequencescapeResources) {
                          const devour = devourApi({ apiUrl: dummyApiUrl }, resources, dummyApiKey)
                          const mockedRequests = []
                          // Find a request in the mockedRequests array that matches the request
                          // object. If no match is found, return undefined.
                        Severity: Major
                        Found in app/frontend/javascript/test_support/mock_api.js - About 2 hrs to fix

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

                          class Sequencescape::Api::V2::Well < Sequencescape::Api::V2::Base # rubocop:todo Style/Documentation
                            include Sequencescape::Api::V2::Shared::HasRequests
                            has_many :qc_results
                            has_many :requests_as_source, class_name: 'Sequencescape::Api::V2::Request'
                            has_many :requests_as_target, class_name: 'Sequencescape::Api::V2::Request'
                          Severity: Minor
                          Found in app/sequencescape/sequencescape/api/v2/well.rb - About 2 hrs to fix

                            Function addComment has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                async addComment(newTitle, newDescription) {
                                  let payload = {
                                    data: {
                                      type: 'comments',
                                      attributes: {
                            Severity: Minor
                            Found in app/frontend/javascript/asset-comments/comment-store.js - About 1 hr to fix

                              Function limberPlateView has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              let limberPlateView = function (defaultTab) {
                                let plateElement = $(this)
                              
                                let control = $('#plate-view-control')
                              
                              
                              Severity: Minor
                              Found in app/frontend/javascript/legacy_scripts_a.js - About 1 hr to fix

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

                                      def can_be_enabled?(states, default: true)
                                        return default unless respond_to?(:state) # No state method.
                                        return default if states.blank? # No states to check.
                                
                                        current_state = state.to_s
                                Severity: Minor
                                Found in app/models/concerns/presenters/statemachine/feature_in_states.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 newScanned has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                let newScanned = function (bed, labware) {
                                  let new_li
                                  // $('#whole\\['+bed+'\\]').detach();
                                  new_li = $(document.createElement('li'))
                                    .attr('data-bed', bed)
                                Severity: Minor
                                Found in app/frontend/entrypoints/pages/bed_verification.js - About 1 hr to fix

                                  Function applyMouseEvents has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const applyMouseEvents = function () {
                                    const core = graph.getCore()
                                  
                                    core.elements().unbind('mouseover')
                                    core.elements().bind('mouseover', (event) => {
                                  Severity: Minor
                                  Found in app/frontend/javascript/pipeline-graph/index.js - About 1 hr to fix

                                    Function extractChildUsedOligos has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function extractChildUsedOligos(parentUsedOligos, parentWellSubmDetails, tagLayout, tagSubstitutions, tagGroupOligos) {
                                      if (
                                        !isValidChildUsedOligoParameters(
                                          parentUsedOligos,
                                          parentWellSubmDetails,
                                    Severity: Minor
                                    Found in app/frontend/javascript/custom-tagged-plate/tagClashFunctions.js - About 1 hr to fix

                                      Function generateTooltipContent has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      const generateTooltipContent = function (ele) {
                                        // pipeline properties
                                        const pipelineName = graph.getElementPipeline(ele)
                                      
                                        // purpose node properties
                                      Severity: Minor
                                      Found in app/frontend/javascript/pipeline-graph/index.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language