SysMO-DB/seek

View on GitHub
app/helpers/publications_helper.rb

Summary

Maintainability
A
2 hrs
Test Coverage

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

  def people_by_project_options(projects)
    options = ""
    projects.each do |project|
      project_options = "<optgroup id=#{project.id} title=\"#{h project.title}\" label=\"#{h truncate(project.title)}\">"
      project.people.sort{|a,b| (a.last_name.nil? ? nil : a.last_name.capitalize) <=> (b.last_name.nil? ? nil : b.last_name.capitalize)}.each do |person|
Severity: Minor
Found in app/helpers/publications_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 author_display_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def author_display_list publication
    if publication.publication_author_orders.empty?
       "<span class='none_text'>Not specified</span>".html_safe
    else
      author_list = []
Severity: Minor
Found in app/helpers/publications_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