Showing 18 of 18 total issues
Method get_score
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def self.get_score(authors1, unique_authors1,
authors2, unique_authors2, year_diff)
count_before = authors1.size + authors2.size
count_after = unique_authors1.size + unique_authors2.size
score = 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"
Further reading
Method get_authors_years
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def get_authors_years(node, res)
res[:authors] = []
res[:years] = []
[:basionymAuthorTeam, :combinationAuthorTeam].each do |au|
if node[au]
- 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 near_match
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.near_match(a_word, normalize_ending = false)
a_word = a_word.strip rescue ''
return '' if a_word == ''
a_word = Taxamatch::Normalizer.normalize a_word
case a_word
Method match_authors
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def match_authors(preparsed_1, preparsed_2)
p1 = { normalized_authors: [], years: [] }
p2 = { normalized_authors: [], years: [] }
if preparsed_1[:infraspecies] || preparsed_2[:infraspecies]
p1 = preparsed_1[:infraspecies].last if preparsed_1[:infraspecies]
- 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_duplicate_authors
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.remove_duplicate_authors(authors1, authors2)
unique_authors1 = authors1.dup
unique_authors2 = authors2.dup
authors1.each do |au1|
authors2.each do |au2|
- 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_duplicate_authors
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.remove_duplicate_authors(authors1, authors2)
unique_authors1 = authors1.dup
unique_authors2 = authors2.dup
authors1.each do |au1|
authors2.each do |au2|
Method get_score
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.get_score(authors1, unique_authors1,
authors2, unique_authors2, year_diff)
count_before = authors1.size + authors2.size
count_after = unique_authors1.size + unique_authors2.size
score = 0
Method get_authors_years
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_authors_years(node, res)
res[:authors] = []
res[:years] = []
[:basionymAuthorTeam, :combinationAuthorTeam].each do |au|
if node[au]
Method match_multinomial
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def match_multinomial(preparsed_1, preparsed_2)
gen_match = match_genera(preparsed_1[:genus], preparsed_2[:genus])
sp_match = match_species(preparsed_1[:species], preparsed_2[:species])
total_length = preparsed_1[:genus][:string].size +
preparsed_2[:genus][:string].size +
Method match_multinomial
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def match_multinomial(preparsed_1, preparsed_2)
gen_match = match_genera(preparsed_1[:genus], preparsed_2[:genus])
sp_match = match_species(preparsed_1[:species], preparsed_2[:species])
total_length = preparsed_1[:genus][:string].size +
preparsed_2[:genus][:string].size +
- 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 match_matches
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def match_matches(genus_match, species_match, infraspecies_match = nil)
match = species_match
if infraspecies_match
match['edit_distance'] += infraspecies_match['edit_distance']
match['match'] &&= infraspecies_match['match']
- 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 match_species
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def match_species(sp1, sp2, opts = {})
sp1_length = sp1[:normalized].size
sp2_length = sp2[:normalized].size
opts = { with_phonetic_match: true }.merge(opts)
min_length = [sp1_length, sp2_length].min
- 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
Consider simplifying this complex logical expression. Open
if (au1.size >= 3 && au1_match) ||
(au2.size >= 3 && au2_match) ||
(au1_match && au2_match)
unique_authors1.delete au1
unique_authors2.delete au2
Consider simplifying this complex logical expression. Open
match = true if ed <= 4 &&
(min_length >= ed * 2) &&
(ed < 2 || sp1[:normalized][0] == sp2[:normalized][0]) &&
(ed < 4 || sp1[:normalized][0...3] == sp2[:normalized][0...3])
Method get_score
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.get_score(authors1, unique_authors1,
authors2, unique_authors2, year_diff)
Method match_genera
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def match_genera(genus1, genus2, opts = {})
genus1_length = genus1[:normalized].size
genus2_length = genus2[:normalized].size
opts = { with_phonetic_match: true }.merge(opts)
min_length = [genus1_length, genus2_length].min
- 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 taxamatch_preparsed
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def taxamatch_preparsed(preparsed_1, preparsed_2)
result = nil
if preparsed_1[:uninomial] && preparsed_2[:uninomial]
result = match_uninomial(preparsed_1, preparsed_2)
end
- 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 process_infraspecies
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_infraspecies(node)
return unless node
@res[:infraspecies] = []
node.each do |infr|
next unless infr[:string]
- 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"