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]
- Read upRead up
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
- Read upRead up
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?
- Read upRead up
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]
- Read upRead up
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"