Method trunc_with_tooltip
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def trunc_with_tooltip(text, length = 32, tooltip_text = "", shorten = true)
text = text.to_s.empty? ? tooltip_text.to_s : text.to_s
tooltip_text = tooltip_text.to_s.empty? ? text : tooltip_text.to_s
options = (shorten && (text.size < length)) ? {} : { :'data-original-title' => tooltip_text, :rel => 'twipsy' }
if shorten
- 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 alert
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def alert(opts = {})
opts[:close] = true if opts[:close].nil?
opts[:header] ||= _("Warning!")
opts[:text] ||= _("Alert")
html_class = "alert #{opts[:class]} "
- 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 alert_header
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def alert_header(text, html_class = nil)
case html_class
when /alert-success/
icon = icon_text("ok", "", :kind => "pficon")
text ||= _("Notice")
- 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"