sanger/limber

View on GitHub

Showing 87 of 187 total issues

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

SCAPE.renderSourceWells = function () {
  let capPoolOffset = 0
  for (let plateIndex = 0; plateIndex < SCAPE.plates.length; plateIndex += 1) {
    if (SCAPE.plates[plateIndex] === undefined) {
      $('.plate-id-' + plateIndex).hide()
Severity: Minor
Found in app/frontend/entrypoints/pages/multi_plate_pooling.js - About 1 hr to fix

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

        value: function (value) {
          // Steps 1-2.
          if (this == null) {
            throw new TypeError('this is null or not defined')
          }
    Severity: Minor
    Found in app/frontend/javascript/lib/array_fill_polyfill.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

    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

            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 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

            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

            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

            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 = (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 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

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

                def build_pools
                  pools = []
                  current_pool = 0
            
                  # wells_grouped_by_collected_by = {0=>['w1', 'w4'], 1=>['w6', 'w2'], 2=>['w9', 'w23']}
            Severity: Minor
            Found in app/models/labware_creators/cardinal_pools_plate.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 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 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

            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

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

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