sanger/limber

View on GitHub

Showing 187 of 187 total issues

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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          def locate_ancestor_tubes
            purpose_name = purpose_config[:ancestor_stock_tube_purpose_name]
      
            ancestor_results = parent.ancestors.where(purpose_name: purpose_name)
            return {} if ancestor_results.blank?
      Severity: Minor
      Found in app/models/labware_creators/plate_split_to_tube_racks.rb and 1 other location - About 1 hr to fix
      app/models/labware_creators/pooled_tubes_by_sample.rb on lines 186..195

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 47.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          def locate_ancestor_tubes
            purpose_name = purpose_config[:ancestor_stock_tube_purpose_name]
      
            ancestor_results = parent.ancestors.where(purpose_name: purpose_name)
            return {} if ancestor_results.blank?
      Severity: Minor
      Found in app/models/labware_creators/pooled_tubes_by_sample.rb and 1 other location - About 1 hr to fix
      app/models/labware_creators/plate_split_to_tube_racks.rb on lines 317..326

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 47.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

        {
          "resource": "plate_purpose",
          "attributes": {
            "name": "",
            "stock_plate": "",
      Severity: Major
      Found in app/frontend/javascript/shared/resources.js and 2 other locations - About 55 mins to fix
      app/frontend/javascript/shared/resources.js on lines 392..405
      app/frontend/javascript/shared/resources.js on lines 848..861

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 54.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

        {
          "resource": "pick_list",
          "attributes": {
            "created_at": "",
            "updated_at": "",
      Severity: Major
      Found in app/frontend/javascript/shared/resources.js and 2 other locations - About 55 mins to fix
      app/frontend/javascript/shared/resources.js on lines 406..419
      app/frontend/javascript/shared/resources.js on lines 848..861

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 54.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

        {
          "resource": "submission",
          "attributes": {
            "uuid": "",
            "name": "",
      Severity: Major
      Found in app/frontend/javascript/shared/resources.js and 2 other locations - About 55 mins to fix
      app/frontend/javascript/shared/resources.js on lines 392..405
      app/frontend/javascript/shared/resources.js on lines 406..419

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 54.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

        def group_wells(plate)
          well_to_pool = plate.wells.each_with_object({}) { |well, store| store[well.location] = well.pool_id }
      
          # We assume that if a well is unpooled then it is in the same pool as the previous pool.
          prior_pool = nil
      Severity: Minor
      Found in app/models/limber/tag_layout_template.rb and 1 other location - About 55 mins to fix
      app/sequencescape/sequencescape/api/v2/tag_layout_template.rb on lines 26..38

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 46.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

        def group_wells(plate)
          well_to_pool = plate.wells.each_with_object({}) { |well, store| store[well.location] = well.pool_id }
      
          # We assume that if a well is unpooled then it is in the same pool as the previous pool.
          prior_pool = nil
      Severity: Minor
      Found in app/sequencescape/sequencescape/api/v2/tag_layout_template.rb and 1 other location - About 55 mins to fix
      app/models/limber/tag_layout_template.rb on lines 18..30

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 46.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        1: {
          id: '1',
          uuid: 'tag-1-group-uuid',
          name: 'Tag Group 1',
          tags: [
      app/frontend/javascript/custom-tagged-plate/testData/customTaggedPlateTestData.js on lines 770..784

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        2: {
          id: '2',
          uuid: 'tag-2-group-uuid',
          name: 'Tag Group 2',
          tags: [
      app/frontend/javascript/custom-tagged-plate/testData/customTaggedPlateTestData.js on lines 755..769

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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

      Severity
      Category
      Status
      Source
      Language