Method destroy
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def destroy
object=params[:class].capitalize.constantize.find(params[:id])
if object && object.is_a?(Sample)
specimen = object.specimen
id_column = Seek::Config.is_virtualliver ? 8 : 6
- 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 existing_specimens
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def existing_specimens
specimens_of_strains = []
strains = []
specimens_with_default_strain =[]
if params[:strain_ids]
Method existing_strains
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def existing_strains
strains_of_organisms = []
organisms = []
if params[:organism_ids]
organism_ids = params[:organism_ids].split(',')
- 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 existing_specimens
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def existing_specimens
specimens_of_strains = []
strains = []
specimens_with_default_strain =[]
if params[:strain_ids]
- 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"