sanger/limber

View on GitHub

Showing 187 of 187 total issues

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

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

          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

            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/normalised_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 byPlateSeq has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

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

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

                  def wells_have_required_information
                    filtered_wells.each do |well|
                      next if well.aliquots.empty?
              
                      errors.add(:csv_file, format(MISSING_WELL_DETAIL, well.location)) unless well_details.include? well.location
              Severity: Minor
              Found in app/models/labware_creators/pcr_cycles_binned_plate_base.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_position_details_hash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def generate_position_details_hash
                    return {} unless valid?
              
                    tube_rack_scan.each_with_object({}) do |row, position_details_hash|
                      # ignore blank rows in file

              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

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

                def ongoing_plates # rubocop:todo Metrics/AbcSize
                  plate_search = api.search.find(Settings.searches.fetch('Find plates'))
                  @purpose_options = helpers.purpose_options('plate')
                  @search_options = OngoingPlate.new(ongoing_plate_search_params)
              
              
              Severity: Minor
              Found in app/controllers/search_controller.rb and 1 other location - About 45 mins to fix
              app/controllers/search_controller.rb on lines 22..29

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

              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

                def ongoing_tubes # rubocop:todo Metrics/AbcSize
                  tube_search = api.search.find(Settings.searches.fetch('Find tubes'))
                  @purpose_options = helpers.purpose_options('tube')
                  @search_options = OngoingTube.new(ongoing_tube_search_params)
                  @search_options.page = params['page'].to_i if params['page'].present?
              Severity: Minor
              Found in app/controllers/search_controller.rb and 1 other location - About 45 mins to fix
              app/controllers/search_controller.rb on lines 12..19

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

              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

                {
                  "resource": "tag_group",
                  "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 345..358

              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

              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

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

                def coerce
                  extend("limber/tag_layout_template/in_#{direction.gsub(/\s+/, '_')}s".camelize.constantize)
                  extend("limber/tag_layout_template/walk_#{walking_by.gsub(/\s+/, '_')}".camelize.constantize)
                rescue NameError => e
                  Rails.logger.warn("Unrecognised layout options: #{e.message}")
              Severity: Minor
              Found in app/models/limber/tag_layout_template.rb and 1 other location - About 45 mins to fix
              app/sequencescape/sequencescape/api/v2/tag_layout_template.rb on lines 14..22

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

              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 coerce
                  extend("limber/tag_layout_template/in_#{direction.gsub(/\s+/, '_')}s".camelize.constantize)
                  extend("limber/tag_layout_template/walk_#{walking_by.gsub(/\s+/, '_')}".camelize.constantize)
                rescue NameError => e
                  Rails.logger.warn("Unrecognised layout options: #{e.message}")
              Severity: Minor
              Found in app/sequencescape/sequencescape/api/v2/tag_layout_template.rb and 1 other location - About 45 mins to fix
              app/models/limber/tag_layout_template.rb on lines 6..14

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

              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 12 locations. Consider refactoring.
              Open

                {
                  "resource": "between_plate_and_tube",
                  "attributes": {
                    "uuid": "",
                    "source_uuid": "",
              Severity: Major
              Found in app/frontend/javascript/shared/resources.js and 11 other locations - About 40 mins to fix
              app/frontend/javascript/shared/resources.js on lines 57..69
              app/frontend/javascript/shared/resources.js on lines 110..122
              app/frontend/javascript/shared/resources.js on lines 123..135
              app/frontend/javascript/shared/resources.js on lines 136..148
              app/frontend/javascript/shared/resources.js on lines 149..161
              app/frontend/javascript/shared/resources.js on lines 191..203
              app/frontend/javascript/shared/resources.js on lines 204..216
              app/frontend/javascript/shared/resources.js on lines 217..229
              app/frontend/javascript/shared/resources.js on lines 230..242
              app/frontend/javascript/shared/resources.js on lines 243..255
              app/frontend/javascript/shared/resources.js on lines 951..963

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

              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 12 locations. Consider refactoring.
              Open

                {
                  "resource": "between_tubes_by_submission",
                  "attributes": {
                    "uuid": "",
                    "source_uuid": "",
              Severity: Major
              Found in app/frontend/javascript/shared/resources.js and 11 other locations - About 40 mins to fix
              app/frontend/javascript/shared/resources.js on lines 57..69
              app/frontend/javascript/shared/resources.js on lines 97..109
              app/frontend/javascript/shared/resources.js on lines 110..122
              app/frontend/javascript/shared/resources.js on lines 123..135
              app/frontend/javascript/shared/resources.js on lines 136..148
              app/frontend/javascript/shared/resources.js on lines 191..203
              app/frontend/javascript/shared/resources.js on lines 204..216
              app/frontend/javascript/shared/resources.js on lines 217..229
              app/frontend/javascript/shared/resources.js on lines 230..242
              app/frontend/javascript/shared/resources.js on lines 243..255
              app/frontend/javascript/shared/resources.js on lines 951..963

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

              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

              Severity
              Category
              Status
              Source
              Language