Method show_element_name
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
def show_element_name(element)
if element.attributes.has_key? 'record_status_id'
if element.is_root?
"<span class='#{h element.record_status.to_s }'>#{h element.name} </span>"
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 show_element_name
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show_element_name(element)
if element.attributes.has_key? 'record_status_id'
if element.is_root?
"<span class='#{h element.record_status.to_s }'>#{h element.name} </span>"
else
Method generate_wbs_project_elt_tree
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def generate_wbs_project_elt_tree(element, tree, show_hidden=false, is_project_show_view=false)
#Root is always display
gap = 2.5
tree ||= String.new
unless element.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 generate_wbs_project_elt_tree
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_wbs_project_elt_tree(element, tree, show_hidden=false, is_project_show_view=false)
#Root is always display
gap = 2.5
tree ||= String.new
unless element.nil?
Method generate_activity_element_tree
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_activity_element_tree(element, tree)
#Root is always display
tree ||= String.new
unless element.nil?
if element.is_root?
Method generate_activity_element_tree
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def generate_activity_element_tree(element, tree)
#Root is always display
tree ||= String.new
unless element.nil?
if element.is_root?
- 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 deeply nested control flow statements. Open
if corresponding_ratio_element.multiple_references == true
strong_class = "strong"
end
Avoid deeply nested control flow statements. Open
if element_ratio_elt.multiple_references == true
strong_class = "strong"
end
Method link_activity_element
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def link_activity_element(element, is_project_show_view=false)
res = String.new
unless is_project_show_view
if element.attributes.has_key? 'record_status_id'
res << link_to('', new_wbs_activity_element_path(:selected_parent_id => element.id, :activity_id => element.wbs_activity_id), :class => 'button_attribute_tooltip icon-plus pull-left', :title => I18n.t('button_add'))
- 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"