rails/app/helpers/search_helper.rb
Method build_onSearch_message
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def build_onSearch_message(form_model)
investigations_count = form_model.total_entries['Investigation'] || 0
activities_count = form_model.total_entries['Activity'] || 0
interactives_count = form_model.total_entries['Interactive'] || 0
show_message_onSearch= ""
- 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 show_material_icon
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def show_material_icon(material, link_url, hide_details)
icon_url = material.icon_image
output = capture_haml do
haml_tag :div, :class => "material_icon" do
unless icon_url.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 build_onSearch_message
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def build_onSearch_message(form_model)
investigations_count = form_model.total_entries['Investigation'] || 0
activities_count = form_model.total_entries['Activity'] || 0
interactives_count = form_model.total_entries['Interactive'] || 0
show_message_onSearch= ""