Showing 6 of 11 total issues
Method validate_answer
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def validate_answer(answer)
if rules[:presence] == "1"
case self
when Rapidfire::Questions::File
if Rails::VERSION::MAJOR >= 6
- 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 save!
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def save!(options = {})
params.each do |question_id, answer_attributes|
answer = @attempt.answers.find { |a| a.question_id.to_s == question_id.to_s }
next unless answer
- 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 validate_answer
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_answer(answer)
if rules[:presence] == "1"
case self
when Rapidfire::Questions::File
if Rails::VERSION::MAJOR >= 6
Method filter_link
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def filter_link(question_id, option)
question_id = question_id.to_s
option = option.to_s
this_filter = {
- 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 validate_answer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_answer(answer)
super(answer)
if rules[:presence] == "1" || answer.answer_text.present?
answer.answer_text.to_s.split(Rapidfire.answers_delimiter).each do |value|
- 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 validate_answer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_answer(answer)
super(answer)
if rules[:presence] == "1" || answer.answer_text.present?
gt_or_lt = {}
- 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"