Showing 430 of 4,506 total issues
Method contributor_for_quiz
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def contributor_for_quiz(reviewer, topic)
raise 'Please select a topic.' if topics? && topic.nil?
raise 'This assignment does not have topics.' unless topics? || !topic
# This condition might happen if the reviewer/quiz taker waited too much time in the
- 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 35 lines of code (exceeds 25 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!'
Method team_users_popup
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def team_users_popup
@ip = session[:ip]
@sum = 0
@team = Team.find(params[:id])
@assignment = Assignment.find(@team.parent_id)
Method list
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list
@participant = AssignmentParticipant.find(params[:id].to_i)
@assignment = @participant.assignment
@slots_filled = SignUpTopic.find_slots_filled(@assignment.id)
@slots_waitlisted = SignUpTopic.find_slots_waitlisted(@assignment.id)
Method import
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.import(row, _row_header, _session, q_id = nil)
if row.length != 5
raise ArgumentError, 'Not enough items: expect 3 columns: your login name, your full name' \
'(first and last name, not separated with the delimiter), and your email.'
end
Method view_completed_question
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def view_completed_question(count, answer, questionnaire_max, tag_prompt_deployments = nil, current_user = nil)
html = '<b>' + count.to_s + '. ' + txt + ' [Max points: ' + questionnaire_max.to_s + ']</b>'
score = answer && !answer.answer.nil? ? answer.answer.to_s : '-'
score_percent = score != '-' ? answer.answer * 1.0 / questionnaire_max : 0
score_color = if score_percent > 0.8
Consider simplifying this complex logical expression. Open
if map.is_a? ReviewResponseMap
reviewee_team = AssignmentTeam.find(map.reviewee_id)
return user_logged_in? &&
(
current_user_has_id?(user_id) ||
Method complete
has 33 lines of code (exceeds 25 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 += '>'
Method assign_reviewers_for_team
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def assign_reviewers_for_team(assignment_id, review_strategy, participants_hash)
if ReviewResponseMap.where(reviewed_object_id: assignment_id, calibrate_to: 0)
.where('created_at > :time',
time: @@time_create_last_review_mapping_record).size < review_strategy.reviews_needed
Method list
has 33 lines of code (exceeds 25 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)
Method view_team
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def view_team
@participant = AssignmentParticipant.find(params[:id])
@assignment = @participant.assignment
@team = @participant.team
@team_id = @team.id
Function Yes
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
"Yes": function() {
//return $.rails.confirmed(link);
$( this ).dialog( "close" );
$(html2).modal();
$("#dialog-confirm2").dialog({
Function getActions
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
getActions: function(props) {
if (props.is_available) {
return node_attributes.assignment.actions.filter((i) => i(props)).map((val, i, arr) => {
let ret = val(props)
/** every five provide a break */
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
var colSpan = '5'
var colDisplayStyle = {
display: ''
}
Method import
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.import(row_hash, _session, id)
raise ArgumentError, 'Not enough items. The string should contain: Author, Reviewer, ReviewOfReviewer1 <, ..., ReviewerOfReviewerN>' if row_hash.length < 3
row_hash[:metareviewers].each do |row|
# ACS Make All contributors as teams
- 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 drawQuestionRow
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
function drawQuestionRow(priorQuestionNum, questionNum, roundNum, tRow, gridWidth, tooltipText, reviewNum, numRounds, roundPrefix, tBody) {
Function checkDeadlines
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function checkDeadlines()
{
var dates = new Array();
var array = document.getElementsByTagName('input');
- 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_to_delayed_queue
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def add_to_delayed_queue
duedates = AssignmentDueDate.where(parent_id: @assignment.id)
duedates.each do |due_date|
deadline_type = DeadlineType.find(due_date.deadline_type_id).name
diff_btw_time_left_and_threshold, min_left = get_time_diff_btw_due_date_and_now(due_date)
- 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 display_directory_tree
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def display_directory_tree(participant, files, display_to_reviewer_flag)
index = 0
participant = @participant if @participant
assignment = participant.assignment # participant is @map.contributor
topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id) # participant is @map.reviewer
- 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_sub_directories
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def list_sub_directories(file, participant)
index = 0
ret = "<ul id= 'subdir." + index.to_s + '.' + index.to_s + "'>"
Dir.foreach(file) do |path|
next if (path == '.') || (path == '..') || (path == '.svn')
- 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"