sanger/limber

View on GitHub

Showing 81 of 177 total issues

Method sorted_pre_cap_pool_json has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def sorted_pre_cap_pool_json(current_plate) # rubocop:todo Metrics/AbcSize
    unsorted =
      current_plate
        .wells_in_columns
        .each_with_object({}) do |well, pool_store|
Severity: Minor
Found in app/helpers/plate_helper.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 newElement has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  newElement: function () {
    let scanned = this
    this.listElement = $(document.createElement('li'))
      .attr('id', 'listElement[' + this.tubeBarcode + ']')
      .attr('class', 'wait-tube')
Severity: Minor
Found in app/frontend/entrypoints/pages/multi_tube_pooling.js - About 1 hr to fix

    Function extractParentWellSubmissionDetails has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function extractParentWellSubmissionDetails(parentPlate) {
      if (!parentPlate) {
        return {}
      }
    
    
    Severity: Minor
    Found in app/frontend/javascript/custom-tagged-plate/tagClashFunctions.js - About 1 hr to fix

      Function jsonFactory has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const jsonFactory = (factoryName, userAttributes = {}) => {
        const factory = findFactory(factoryName)
        const type = resourceName(factoryName)
        const resource_config = new ResourceConfig(type)
      
      
      Severity: Minor
      Found in app/frontend/javascript/test_support/factories/json_factory.js - About 1 hr to fix

        Function plateFactory has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const plateFactory = function (options = {}) {
          const { _filledWells, _wellOptions, ...plateOptions } = options
          let uuid = plateOptions.uuid || 'plate-uuid'
          let id = plateOptions.id || '1'
          // Bit inefficient, in that we generate wells even if we immediately override them
        Severity: Minor
        Found in app/frontend/javascript/test_support/factories/plate_factory.js - About 1 hr to fix

          Function extractSubmDetailsFromAliquots has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          function extractSubmDetailsFromAliquots(well) {
            let submDetails = { id: null, usedTags: [] }
          
            const requestsLen = well.aliquots.length
            for (let i = 0; i < requestsLen; i++) {
          Severity: Minor
          Found in app/frontend/javascript/custom-tagged-plate/tagClashFunctions.js - About 55 mins 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 checkDuplicates has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          const checkDuplicates = (plateList) => {
            return (plate) => {
              let occurrences = 0
              for (let i = 0; i < plateList.length; i++) {
                if (plateList[i] && plate && plateList[i].uuid === plate.uuid) {
          Severity: Minor
          Found in app/frontend/javascript/shared/components/plateScanValidators.js - About 55 mins 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 checkDuplicates has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          const checkDuplicates = (tubeList) => {
            return (tube) => {
              let occurrences = 0
              for (let i = 0; i < tubeList.length; i++) {
                if (tubeList[i] && tube && tubeList[i].uuid === tube.uuid) {
          Severity: Minor
          Found in app/frontend/javascript/shared/components/tubeScanValidators.js - About 55 mins 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 validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def validate(presenter) # rubocop:todo Metrics/AbcSize
                analyzer = Analyzer.new(presenter.labware)
                if analyzer.no_submission?
                  presenter.errors.add(:plate, 'has no requests. Please check that your submission built correctly.')
                elsif analyzer.no_samples?
          Severity: Minor
          Found in app/models/validators/stock_state_validator.rb - About 55 mins 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 mould_data_for_view has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def mould_data_for_view(purposes, labware_records)
              {}.tap do |output|
                # Make sure there's an entry for each of the purposes, even if no records
                purposes.each { |p| output[p] = [] }
          
          
          Severity: Minor
          Found in app/controllers/pipeline_work_in_progress_controller.rb - About 55 mins 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 extractSubmDetailsFromRequestsAsSource has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          function extractSubmDetailsFromRequestsAsSource(well) {
            let submDetails = { id: null, usedTags: [] }
          
            const requestsLen = well.requests_as_source.length
            for (let i = 0; i < requestsLen; i++) {
          Severity: Minor
          Found in app/frontend/javascript/custom-tagged-plate/tagClashFunctions.js - About 55 mins 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 generate_msg_list_for_file_not_matching_submission has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def generate_msg_list_for_file_not_matching_submission
                parent_wells = parent.wells.map(&:location)
                parent_wells.filter_map do |well_locn|
                  well_in_submission = parent_wells_with_requests.include?(well_locn)
                  valid_well_row_in_file = well_locns_from_filtered_well_details.include?(well_locn)
          Severity: Minor
          Found in app/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq.rb - About 55 mins 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 byFixedGroupByPlate has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function byFixedGroupByPlate(_well, tags, _relIndex, absIndex, offset, _counters) {
          Severity: Minor
          Found in app/frontend/javascript/custom-tagged-plate/tagLayoutFunctions.js - About 45 mins to fix

            Function byPool has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function byPool(well, tags, _relIndex, _absIndex, offset, counters) {
            Severity: Minor
            Found in app/frontend/javascript/custom-tagged-plate/tagLayoutFunctions.js - About 45 mins to fix

              Method check_control_rules_from_config has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def check_control_rules_from_config(control_locations)
                    list_of_rules.each do |rule|
                      case rule.type
                      when 'not'
                        # locations must not match this combination of wells (order is important)
              Severity: Minor
              Found in app/models/labware_creators/stamped_plate_adding_randomised_controls.rb - About 45 mins 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 generate_tag_layout has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def generate_tag_layout(plate) # rubocop:todo Metrics/AbcSize
                  tags = tag_ids
                  groups = group_wells_of_plate(plate)
                  pools = groups.filter_map { |w| w.try(:[], 1) }.uniq
                  groups.each_with_object({}) do |(well, pool_id, _well_empty), tagged_wells|
              Severity: Minor
              Found in app/models/limber/tag_layout_template/tag_walker.rb - About 45 mins 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 build_transfers_hash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def build_transfers_hash(bins, number_of_rows, compression_reqd) # rubocop:todo Metrics/AbcSize
                    binner = Binner.new(compression_reqd, number_of_rows)
                    bins
                      .values
                      .each_with_object({})
              Severity: Minor
              Found in app/models/utility/concentration_binning_calculator.rb - About 45 mins 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_all_labware_metadata has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def update_all_labware_metadata(robot_barcode)
                  @robot.beds.each_value do |bed|
                    next unless bed.transitions? && bed.labware
                    update_bed_labware_metadata(bed, robot_barcode)
                  rescue Sequencescape::Api::ResourceNotFound
              Severity: Minor
              Found in app/controllers/robots_controller.rb - About 45 mins 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 byGroupByPlate has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function byGroupByPlate(_well, tags, relIndex, _absIndex, offset, _counters) {
              Severity: Minor
              Found in app/frontend/javascript/custom-tagged-plate/tagLayoutFunctions.js - About 45 mins to fix

                Function processTagsPerWell has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function processTagsPerWell(acc, well, relIndex, absIndex, tagsPerWell, walker) {
                Severity: Minor
                Found in app/frontend/javascript/custom-tagged-plate/tagLayoutFunctions.js - About 45 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language