Method duplicate_question_and_answers
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.duplicate_question_and_answers
require 'set'
same = [], diff = []
sql = 'select min(q.id), q2.id from questions as q
Method duplicate_question_and_answers
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.duplicate_question_and_answers
require 'set'
same = [], diff = []
sql = 'select min(q.id), q2.id from questions as q
- 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 is_complete_helper_real
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def is_complete_helper_real
return false, "nicht freigegeben" if !released?
return false, "keine Antworten" if answers.size == 0
# note: matrix_validate? is false if there is more than one answers.
# Thus it’s enough to ensure that the first answer is correct rather
- 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
Avoid too many return
statements within this method. Open
return false, "Elter nicht freigegeben" if parent && !parent.released?
Avoid too many return
statements within this method. Open
return true, ""
Avoid too many return
statements within this method. Open
return false, "Unerreichbar, da das Elter eine andere Zielgruppe als diese Frage hat." unless QuestionReachability.new(self).any_reachable?
Method dot_region_siblings
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def dot_region_siblings(may_omit)
return "" unless parent.respond_to?(:questions)
limit = may_omit ? 6 : -1
qs = siblings.includes(:answers, :parent).limit(limit).to_a
- 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"