vegantech/sims

View on GitHub
app/models/recommendation.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method status has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def status
    if draft?
      STATUS[:draft]
    elsif promoted? and RECOMMENDATION[recommendation][:show_elig]
      STATUS[:can_refer]
Severity: Minor
Found in app/models/recommendation.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 setup_from_checklist_or_definition has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def setup_from_checklist_or_definition
    if checklist
      self.recommendation_definition ||= checklist.checklist_definition.recommendation_definition if checklist
      self.district_id ||= checklist.district_id
      self.student_id ||= checklist.student_id
Severity: Minor
Found in app/models/recommendation.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 answers= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def answers=(hsh={})
    hsh.each do |h|
      h=h.last if h.is_a?Array and h.size==2
      h=h.symbolize_keys
      if h[:recommendation_answer_definition_id]
Severity: Minor
Found in app/models/recommendation.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 mark_promoted_if_needed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def mark_promoted_if_needed
    if draft?
      self.promoted=false
      return true
    elsif errors.empty? and recommendation and should_promote?
Severity: Minor
Found in app/models/recommendation.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