sanger/limber

View on GitHub
app/models/utility/concentration_binning_calculator.rb

Summary

Maintainability
A
1 hr
Test Coverage
A
95%

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

    def build_transfers_hash(bins, number_of_rows, compression_reqd) # rubocop:todo Metrics/AbcSize
      binner = Binner.new(compression_reqd, number_of_rows)
      bins
        .values
        .each_with_object({})
Severity: Minor
Found in app/models/utility/concentration_binning_calculator.rb - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method concentration_bins has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def concentration_bins(well_amounts) # rubocop:todo Metrics/AbcSize
      # Returns eg. { 1 => [], 2 => [], 3 => [] }
      conc_bins = (1..number_of_bins).index_with { |_bin_number| [] }
      well_amounts.each do |well_locn, amount|
        bins_template.each_with_index do |bin_template, bin_index|
Severity: Minor
Found in app/models/utility/concentration_binning_calculator.rb - About 25 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 compute_well_amounts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def compute_well_amounts(wells, multiplication_factor)
      # sort on well coordinate to ensure wells are in plate column order
      wells
        .sort_by(&:coordinate)
        .each_with_object({}) do |well, well_amounts|
Severity: Minor
Found in app/models/utility/concentration_binning_calculator.rb - About 25 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

There are no issues that match your filters.

Category
Status