SysMO-DB/seek

View on GitHub
app/helpers/resource_list_item_helper.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Method list_item_title has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def list_item_title resource, options={}
    cache_key = "rli_title_#{resource.cache_key}_#{resource.authorization_supported? && resource.can_manage?}"
    result = Rails.cache.fetch(cache_key) do
      title=options[:title]
      url=options[:url]
Severity: Minor
Found in app/helpers/resource_list_item_helper.rb - About 2 hrs to fix

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 list_item_visibility has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def list_item_visibility item,css_class="visibility_icon"
    title = ""
    html  = ""
    policy = item.policy

Severity: Minor
Found in app/helpers/resource_list_item_helper.rb - About 1 hr to fix

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 list_item_visibility has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def list_item_visibility item,css_class="visibility_icon"
    title = ""
    html  = ""
    policy = item.policy

Severity: Minor
Found in app/helpers/resource_list_item_helper.rb - About 1 hr to fix

    Method list_item_optional_attribute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def list_item_optional_attribute attribute, value, url=nil, missing_value_text="Not specified"
        if value.blank?
          value = "<span class='none_text'>#{missing_value_text}</span>"
        else
          value = value.html_safe? ? value : h(value)
    Severity: Minor
    Found in app/helpers/resource_list_item_helper.rb - About 1 hr to fix

    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 list_item_simple_list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def list_item_simple_list items, attribute
        html = "<p class=\"list_item_attribute\"><b>#{attribute}:</b> "
        if items.empty?
          html << "<span class='none_text'>Not specified</span>"
        else
    Severity: Minor
    Found in app/helpers/resource_list_item_helper.rb - About 1 hr to fix

    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 list_item_expandable_text has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def list_item_expandable_text attribute, text, length=200
        full_text  = text_or_not_specified(text, :description => false, :auto_link=>false)
        trunc_text = text_or_not_specified(text, :description => false, :auto_link=>false, :length=>length)
        #Don't bother with fancy stuff if not enough text to expand
        if full_text == trunc_text
    Severity: Minor
    Found in app/helpers/resource_list_item_helper.rb - About 45 mins to fix

    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

    There are no issues that match your filters.

    Category
    Status