Applicat/rails_info

View on GitHub
app/helpers/rails_info/resources_helper.rb

Summary

Maintainability
C
1 day
Test Coverage

Method nested_resource_presenter_renderer has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  def nested_resource_presenter_renderer(presenter, parent_id = '')
    tabs_for do |tab|
      presenter.each do |title,resource_presenter|  
        id = parent_id.blank? ? title.parameterize : "#{parent_id}-#{title.parameterize}"
        tab_title = resource_presenter[:group_by] ? "#{title} (Group by: #{resource_presenter[:group_by]})" : title    
Severity: Minor
Found in app/helpers/rails_info/resources_helper.rb - About 3 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 resource_columns has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def resource_columns(collection, group_by = nil)
    collection_columns = []
    
    if collection.first.is_a?(Array)
      raise "Please wrap the :collection by help.collection_map: #{collection.inspect}"
Severity: Minor
Found in app/helpers/rails_info/resources_helper.rb - About 1 hr to fix

    Method resource_columns has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      def resource_columns(collection, group_by = nil)
        collection_columns = []
        
        if collection.first.is_a?(Array)
          raise "Please wrap the :collection by help.collection_map: #{collection.inspect}"
    Severity: Minor
    Found in app/helpers/rails_info/resources_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 resource_cell has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def resource_cell(row, column)
        if row.is_a?(Hash)
          return "" unless row.has_key?(column)
          
          content = row[column].to_s
    Severity: Minor
    Found in app/helpers/rails_info/resources_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 grouped_collection has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def grouped_collection(title, collection, group_by)
        @grouped_collections ||= {}
        
        collection_key = "#{title}-{group_by}-#{collection.length}"
        
    Severity: Minor
    Found in app/helpers/rails_info/resources_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 resource_tree has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def resource_tree(presenter, parent_id = '')   
        content = ""
         
        presenter.each do |title, resource_presenter|
          id = parent_id.blank? ? title.parameterize : "#{parent_id}-#{title.parameterize}"
    Severity: Minor
    Found in app/helpers/rails_info/resources_helper.rb - About 35 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