Method enhance_metadata
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def enhance_metadata(referent, editions)
# Which one should we use to enhance? Whichever has the largest
# oclcnum, or if none of them have an oclcnum, then whichever
# has the most metadata elements.
winner = nil
- 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_data
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_data(request)
ids = get_identifiers(request.referent)
return nil if ids.blank?
ol_keys = do_id_query(ids)
return nil if ol_keys.blank?
- 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 create_download_link
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_download_link(request, editions)
return nil unless editions
ed = editions[0] if editions.length
return nil unless ed['ocaid']
server = "www.archive.org"
- 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_identifiers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_identifiers(rft)
isbn = get_identifier(:urn, "isbn", rft)
oclcnum = get_identifier(:info, "oclcnum", rft)
lccn = get_identifier(:info, "lccn", rft)
- 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 score_metadata
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def score_metadata(edition)
oclcnum = edition["oclc_numbers"].collect {|i| i.to_i}.max unless edition["oclc_numbers"].blank?
oclcnum = nil if oclcnum == 0
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"