Showing 84 of 127 total issues
Method add_reference
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_reference(snapshot_id)
unless has_reference?
spectrum = Spectrum.find(value)
if spectrum.snapshots && !spectrum.snapshots.empty?
snapshot_id ||= spectrum.snapshots.last.id
- 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 remove
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def remove
@set = SpectraSet.find params[:id]
@spectrum = Spectrum.find params[:s]
if @set.user_id == current_user.id || current_user.role == 'admin'
if @set.spectrums.length > 1
- 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 delete
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def delete
@set = SpectraSet.find params[:id]
if @set.user_id == current_user.id || current_user.role == 'admin'
if @set.delete
flash[:notice] = 'Deleted set.'
- 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 bin_data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def bin_data(binsize)
bins = {}
count = {}
data_as_hash.each do |datum|
- 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"