sanger/limber

View on GitHub

Showing 177 of 177 total issues

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

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

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

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

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

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

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

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

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

        {
          "resource": "lot_type",
          "attributes": {
            "uuid": "",
            "name": "",
      Severity: Minor
      Found in app/frontend/javascript/shared/resources.js and 1 other location - About 45 mins to fix
      app/frontend/javascript/shared/resources.js on lines 874..887

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

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

      Severity
      Category
      Status
      Source
      Language