Showing 430 of 4,506 total issues
Method add_answer
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def add_answer(answer)
# We want to add each response score from this review (answer) to its corresponding
# question row.
@list_of_rows.each do |row|
next unless row.question_id == answer.question_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 get_user_list
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_user_list
user_list = []
# If the user is a super admin, fetch all users
user_list = SuperAdministrator.get_user_list if role.super_admin?
- 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 run
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.run(assignment_id)
assignment = Assignment.find(assignment_id)
teams = Team.where(parent_id: assignment_id)
code_assignment_submission_id = create_new_assignment_submission(assignment.name + ' (Code)')
- 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 add_reviews
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def add_reviews(participant, team, vary)
if @questionnaire_type == 'ReviewQuestionnaire'
reviews = if vary
ReviewResponseMap.get_responses_for_team_round(team, @round)
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 create_approved_user
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def create_approved_user
# If a user isn't selected before approving or denying, they are given an error message
if params[:selection].nil?
flash[:error] = 'Please select at least one user before approving or rejecting'
redirect_to action: 'list_pending_requested'
- 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 inherit
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def inherit
assignment = Assignment.find(params[:id])
course = assignment.course
@copied_participants = []
if course
- 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 add_new_questions
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def add_new_questions
questionnaire_id = params[:id]
# If the questionnaire is being used in the active period of an assignment, delete existing responses before adding new questions
if AnswerHelper.check_and_delete_responses(questionnaire_id)
flash[:success] = 'You have successfully added a new question. Any existing reviews for the questionnaire have been deleted!'
- 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 assignment_tagging_progress
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def assignment_tagging_progress
teams = Team.where(parent_id: assignment_id)
questions = Question.where(questionnaire_id: questionnaire.id, type: question_type)
questions_ids = questions.map(&:id)
user_answer_tagging = []
Function getShowHour
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getShowHour()
{
var finalHour;
if (TimeMode==12)
{
Method display_tagging_interval_chart
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def display_tagging_interval_chart(intervals)
# if someone did not do any tagging in 30 seconds, then ignore this interval
threshold = 30
intervals = intervals.select { |v| v < threshold }
unless intervals.empty?
Function collapseObj
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function collapseObj(obj, atag, header) {
obj.style.display = 'none';
atag.innerHTML = '<img src="/assets/expand.png">';
header.style.backgroundColor = 'white';
header.style.color = "#000000";
Method feedback_response_report
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.feedback_response_report(id, _type)
# Example query
# SELECT distinct reviewer_id FROM response_maps where type = 'FeedbackResponseMap' and
# reviewed_object_id in (select id from responses where
# map_id in (select id from response_maps where reviewed_object_id = 722 and type = 'ReviewResponseMap'))
Function collapseObj
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function collapseObj(obj, atag, header) {
obj.style.display = 'none';
atag.innerHTML = '<img src="/assets/expand.png">';
header.style.backgroundColor = 'white';
header.style.color = "#000000";
- 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 get_assessments_round_for
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_assessments_round_for(participant, round)
team = AssignmentTeam.team(participant)
return nil unless team
team_id = team.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
Function clearbrowseredge
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function clearbrowseredge(obj, whichedge){
if (whichedge=="rightedge"){
edgeoffsetx=0
var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
- 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 complete
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def complete(count, questionnaire_min, questionnaire_max, answer = nil)
html = '<div><label for="responses_' + count.to_s + '">' + txt + '</label></div>'
html += '<input id="responses_' + count.to_s + '_score" name="responses[' + count.to_s + '][score]" type="hidden"'
html += 'value="' + answer.answer.to_s + '"' unless answer.nil?
html += '>'
- 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 two_node_cycles
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def two_node_cycles(assignment_participant)
collusion_cycles = []
assignment_participant.reviewers.each do |ap|
next unless ap.reviewers.include?(assignment_participant)
if assignment_participant.reviews_by_reviewer(ap).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 list
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def list
# we can assume the id is of the current user and for the participant
# if the assignment has team reviewers, other controllers take care of getting the team from this object
@participant = AssignmentParticipant.find(params[:id])
return unless current_user_id?(@participant.user_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 export
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.export(csv, _parent_id, options)
users = User.all
users.each do |user|
tcsv = []
tcsv.push(user.name, user.fullname, user.email) if options['personal_details'] == 'true'
- 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 all_students_all_reviews
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def all_students_all_reviews
course = Course.find(params[:course_id])
@assignments = course.assignments.reject(&:is_calibrated).reject { |a| a.participants.empty? }
@course_participants = course.get_participants
insure_existence_of(@course_participants, course)
- 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"