Method merge_centroids
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def merge_centroids(peaklists, opts={})
opts[:return_data] = true if opts[:only_data]
# Create Mspire::Bin objects
bins = opts[:bins] ? opts[:bins] : create_bins(peaklists, opts)
- Read upRead up
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 merge_centroids
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def merge_centroids(peaklists, opts={})
opts[:return_data] = true if opts[:only_data]
# Create Mspire::Bin objects
bins = opts[:bins] ? opts[:bins] : create_bins(peaklists, opts)
Method peak_boundaries
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def peak_boundaries(gt=0.0)
in_peak = false
prev_y = gt
prev_prev_y = gt
peak_inds = []
- Read upRead up
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 split_contiguous
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def split_contiguous(methd=:greedy_y, local_min_indices=nil)
local_min_indices ||= ((pb=peak_boundaries.first) && pb.shift && pb.pop && pb)
if local_min_indices.size == 0
self
- Read upRead up
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 split_contiguous
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def split_contiguous(methd=:greedy_y, local_min_indices=nil)
local_min_indices ||= ((pb=peak_boundaries.first) && pb.shift && pb.pop && pb)
if local_min_indices.size == 0
self
Method peak_boundaries
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def peak_boundaries(gt=0.0)
in_peak = false
prev_y = gt
prev_prev_y = gt
peak_inds = []
Method create_bins
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create_bins(peaklists, opts)
min, max = min_max_x(peaklists)
divisions = []
bin_width = opts[:bin_width]
- Read upRead up
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 min_max_x
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def min_max_x(peaklists)
# find the min and max across all spectra
first_peaklist = peaklists.first
min = first_peaklist.first.x; max = first_peaklist.last.x
peaklists.each do |peaklist|
- Read upRead up
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 split
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def split(split_multipeaks_mthd=:zero)
if split_multipeaks_mthd == :zero
split_on_zeros
else
boundaries = peak_boundaries(0.0)
- Read upRead up
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"