Method add_856_links
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
def add_856_links(request, marc_records, options = {})
options[:default_service_type] ||= "fulltext"
options[:match_reliability] ||= ServiceResponse::MatchExact
responses_added = Hash.new
- 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 edition_statement
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def edition_statement(marc, options = {})
options[:include_repro_info] ||= true
options[:exclude_533_fields] = ['7','f','b', 'e']
parts = Array.new
- 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 add_856_links
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_856_links(request, marc_records, options = {})
options[:default_service_type] ||= "fulltext"
options[:match_reliability] ||= ServiceResponse::MatchExact
responses_added = Hash.new
Method edition_statement
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def edition_statement(marc, options = {})
options[:include_repro_info] ||= true
options[:exclude_533_fields] = ['7','f','b', 'e']
parts = Array.new
Method service_type_for_856
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def service_type_for_856(field, options)
options[:default_service_type] ||= "fulltext_title_level"
# LC records here at hopkins have "Table of contents only" in the 856$3
# Think that's a convention from LC?
- 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_years
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_years(marc)
array = []
# no marc 008? Weird, but okay.
return array unless marc['008']
- 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 too many return
statements within this method. Open
return options[:default_service_type]
Avoid too many return
statements within this method. Open
return "highlighted_link"