Showing 13 of 24 total issues
Class User
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ActiveRecord::Base
has_merit
rolify role_join_table_name: 'roles_users'
Method process_answer
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_answer(question, params)
# adding should always be at tail!
# Create answer object
# Create answer edge from tail to new answer
Method oodt_status
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def oodt_status #6
response = oodt.post "users/@@status", user_hash
body = parse_body(response)
if response.success?
- 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 value=
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def value=(val)
answer_values.clear
question.answer_templates.each do |template|
target_field = template.data_type
- 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 pair_with_legacy_ccfa_partners_account
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def pair_with_legacy_ccfa_partners_account(email) #3
response = oodt.post "users/@@link", user_hash.merge!({email: email})
body = parse_body(response)
if response.success?
- 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 minimum_set
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def minimum_set(question_flow, start_point = nil)
current_q = start_point
# go to start of group
if start_point.present?
- 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 update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update
authorize_action_for @research_topic
if current_user.can_moderate?(@research_topic)
@research_topic.update(research_topic_moderator_params)
- 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 find_longest_path
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def find_longest_path(source, destination, by = :time)
topological_order = tsorted_edges[tsorted_edges.find_index(source.id)..tsorted_edges.find_index(destination.id)]
distances = Hash[topological_order.map {|q| [q,-1*Float::INFINITY]}]
- 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 process_answer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def process_answer(question, params)
# adding should always be at tail!
# Create answer object
# Create answer edge from tail to new 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 leaf
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def leaf
if first_question.descendants.length > 0
leaves = first_question.descendants.select {|q| q.leaf?}
raise StandardError, "Multiple leaves found!" if leaves.length > 1
- 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 next_question
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def next_question
candidate_edges = QuestionEdge.where(parent_question_id: question.id, direct: true, question_flow_id: answer_session.question_flow.id)
if candidate_edges.empty?
nil
- 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 vote_class
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def vote_class(question, rating)
if current_user and question.has_vote?(current_user, rating)
if rating > 0
"btn-success"
else
- 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 have_checked?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def have_checked?(answer, answer_template, val)
if answer.present? and answer.value.present? and answer.value[answer_template.id].present?
saved_val = answer.value[answer_template.id]
if saved_val.kind_of?(Array)
- 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"