SysMO-DB/seek

View on GitHub
app/helpers/homes_helper.rb

Summary

Maintainability
C
1 day
Test Coverage

Method display_single_entry has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def display_single_entry entry
      html=''
      unless entry.blank?
          #get the link of the entry
          entry_link = entry.url
Severity: Minor
Found in app/helpers/homes_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 filter_feeds_entries_with_chronological_order has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def filter_feeds_entries_with_chronological_order feeds, number_of_entries=10
    filtered_entries = []
    unless feeds.blank?
      feeds.each do |feed|
         entries = try_block{feed.entries}
Severity: Minor
Found in app/helpers/homes_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 recent_project_changes_hash has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def recent_project_changes_hash

    projects=current_user.person.projects
    
    people=Person.order('updated_at DESC')
Severity: Minor
Found in app/helpers/homes_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 recent_changes_hash has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def recent_changes_hash

    item_hash=classify_for_tabs(Person.order('updated_at DESC').limit(RECENT_SIZE))
    item_hash.merge! classify_for_tabs(Project.order('updated_at DESC').limit(RECENT_SIZE))

Severity: Minor
Found in app/helpers/homes_helper.rb - About 55 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

Method recently_downloaded_item_logs_hash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def recently_downloaded_item_logs_hash time=1.month.ago, number_of_item=10
    Rails.cache.fetch("download_activity_#{current_user_id}") do
      activity_logs = ActivityLog.no_spider.where(["action = ? AND created_at > ?", 'download', time]).order("created_at DESC")
      selected_activity_logs = []
      selected_items = []
Severity: Minor
Found in app/helpers/homes_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

Method recently_added_item_logs_hash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def recently_added_item_logs_hash time=1.month.ago, number_of_item=10
    Rails.cache.fetch("create_activity_#{current_user_id}") do
      item_types = Seek::Util.user_creatable_types.collect{|type| type.name} | [Project,Programme]
      activity_logs = ActivityLog.where(["action = ? AND created_at > ? AND activity_loggable_type in (?)", 'create', time, item_types]).order("created_at DESC")
      selected_activity_logs = []
Severity: Minor
Found in app/helpers/homes_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

Method convert_logs_to_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def convert_logs_to_hash logs
    logs.collect do |log|
      item = log.activity_loggable
      {
          type: text_for_resource(item),
Severity: Minor
Found in app/helpers/homes_helper.rb - About 25 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

Method display_single_log_item_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def display_single_log_item_hash item, action
      html=''
       unless item.blank?
         image=item[:avatar_image]
          icon  = link_to(image, item[:url], :class=> "asset", :title => tooltip_title_attrib(item[:type]))
Severity: Minor
Found in app/helpers/homes_helper.rb - About 25 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