Method otu
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def otu(columns)
r = BatchLoad::ColumnResolver::Result.new
if columns['otu_id']
begin
- 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 geographic_area
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def geographic_area(columns, data_origin = nil)
r = BatchLoad::ColumnResolver::Result.new
if columns['geographic_area_id']
begin
- 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 source
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def source(columns)
r = BatchLoad::ColumnResolver::Result.new
if columns['source_id']
begin
- 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 otu
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def otu(columns)
r = BatchLoad::ColumnResolver::Result.new
if columns['otu_id']
begin
Method geographic_area
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def geographic_area(columns, data_origin = nil)
r = BatchLoad::ColumnResolver::Result.new
if columns['geographic_area_id']
begin
Method data_attribute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def data_attribute(columns, type = 'import')
r = BatchLoad::ColumnResolver::Result.new
predicate = columns['predicate']
value = columns['value']
- 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
Avoid deeply nested control flow statements. Open
if list.blank? # treat it like a taxon name
list = Otu.joins(:taxon_name)
.where(taxon_names: {cached: name}, project_id: proj_id)
.limit(2)
end
Avoid deeply nested control flow statements. Open
r.error_messages << "Multiple OTUs matched the name '#{name}'." if r.multiple_matches?
Avoid deeply nested control flow statements. Open
r.error_messages << "No OTU with name '#{name}' exists." if r.no_matches?
Method collection_object_by_identifier
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def collection_object_by_identifier(columns)
r = BatchLoad::ColumnResolver::Result.new
# find a namespace (ns1) with a short_name of row[headers[0]] (id1)
# find a collection_object which has an identifier which has a namespace (ns1), and a cached of
- 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"