Method field_with_highlighting
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def field_with_highlighting document, field, sep=field_value_separator
highlighting = blacklight_config.highlighting
if !(field.is_a? Symbol) && !(field.is_a? String)
options = field
field = options[:'field']
- 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 dateHelper
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def dateHelper dates
dateRet = ''
c2 = false
c3 = false
c4 = false
- 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 field_with_highlighting
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def field_with_highlighting document, field, sep=field_value_separator
highlighting = blacklight_config.highlighting
if !(field.is_a? Symbol) && !(field.is_a? String)
options = field
field = options[:'field']
Method dateHelper
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def dateHelper dates
dateRet = ''
c2 = false
c3 = false
c4 = false
Avoid deeply nested control flow statements. Open
elsif !c2 && !c3 && !c4
if date['value']
dateRet = date['value']
else
dateRet = date['beginDate']
Avoid deeply nested control flow statements. Open
if date['value']
dateRet = date['value']
else
dateRet = date['beginDate']
end
Avoid deeply nested control flow statements. Open
if values[i].eql? vo
values[i] = v
break
end
Avoid too many return
statements within this method. Open
return highlight_values.join(sep).html_safe
Avoid too many return
statements within this method. Open
return highlight_values.join(sep).html_safe
Avoid too many return
statements within this method. Open
return values.map { |v|v }.join(sep).html_safe
Method to_stats_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_stats_path (path)
if !path.blank? && !session[:user_id].blank?
path += path.index('?').nil? ? '?' : '&'
path + 'access=curator'
else
- 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 parseJsonDate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parseJsonDate jsonString, sep
datehash = JSON.parse jsonString
dates = Array.new
dates << datehash['value'] unless datehash['value']==nil?
dates << datehash['beginDate'] unless datehash['beginDate']==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"