lib/taxamatch_rb/authmatch.rb
Method get_score
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
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 remove_duplicate_authors
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
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
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
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
Consider simplifying this complex logical expression. Open
Open
if (au1.size >= 3 && au1_match) ||
(au2.size >= 3 && au2_match) ||
(au1_match && au2_match)
unique_authors1.delete au1
unique_authors2.delete au2
Method get_score
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def self.get_score(authors1, unique_authors1,
authors2, unique_authors2, year_diff)