Showing 2,813 of 2,813 total issues
Assignment Branch Condition size for display_as_html is too high. [16.25/15] Open
def display_as_html(prefix = nil, count = nil, _file_url = nil, show_tags = nil, current_user = nil)
identifier = ""
# The following three lines print out the type of rubric before displaying
# feedback. Currently this is only done if the rubric is Author Feedback.
# It doesn't seem necessary to print out the rubric type in the case of
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Perceived complexity for get_intelligent_topic_row is too high. [8/7] Open
def get_intelligent_topic_row(topic, selected_topics, max_team_size = 3)
row_html = ''
if selected_topics.present?
selected_topics.each do |selected_topic|
row_html = if selected_topic.topic_id == topic.id and !selected_topic.is_waitlisted
- Read upRead up
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Cyclomatic complexity for adjust_advice_size is too high. [7/6] Open
def self.adjust_advice_size(questionnaire, question)
# now we only support question advices for scored questions
if question.is_a?(ScoredQuestion)
max = questionnaire.max_question_score
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Cyclomatic complexity for has_team_and_metareview? is too high. [7/6] Open
def has_team_and_metareview?
if params[:action] == "view"
@assignment = Assignment.find(params[:id])
@assignment_id = @assignment.id
elsif %w[view_my_scores view_review].include? params[:action]
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Perceived complexity for list_sub_directories is too high. [8/7] 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 == "." or path == ".." or path == ".svn"
- Read upRead up
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Assignment Branch Condition size for calculate_submission_penalty is too high. [16.43/15] Open
def calculate_submission_penalty
submission_due_date = AssignmentDueDate.where(deadline_type_id: @submission_deadline_type_id,
parent_id: @assignment.id).first.due_at
resubmission_times = @participant.resubmission_times
if resubmission_times.any?
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Perceived complexity for compute_penalty_on_reviews is too high. [8/7] Open
def compute_penalty_on_reviews(review_mappings, review_due_date, num_of_reviews_required)
review_map_created_at_list = []
penalty = 0
# Calculate the number of reviews that the user has completed so far.
review_mappings.each do |map|
- Read upRead up
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Assignment Branch Condition size for stage_deadline is too high. [16.25/15] Open
def stage_deadline
topic_id = SignedUpTeam.topic_id(self.parent_id, self.user_id)
stage = assignment.stage_deadline(topic_id)
if stage == 'Finished'
return (assignment.staggered_deadline? ? TopicDueDate.find_by(parent_id: topic_id).try(:last).try(:due_at) : assignment.due_dates.last.due_at).to_s
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for define_user is too high. [16.03/15] Open
def self.define_user(attrs, session, params, home_page)
user = User.find_by(name: attrs["name"])
user = create_new_user(attrs, session) if user.nil?
if !params[:course_id].nil?
participant = add_user_to_course(params, user)
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Cyclomatic complexity for list_sub_directories is too high. [7/6] 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 == "." or path == ".." or path == ".svn"
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Perceived complexity for flash_msg is too high. [8/7] Open
def flash_msg
flash[:error] = if current_role && current_role.name.try(:downcase).start_with?('a', 'e', 'i', 'o', 'u')
if params[:action] == 'new'
"An #{current_role_name.try(:downcase)} is not allowed to create this/these #{params[:controller]}"
else
- Read upRead up
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Perceived complexity for associated_courses is too high. [8/7] Open
def associated_courses(user)
# NOTE: testing for roles in general is a bad practice but since the data base does not provide clear
# way to get this association we have no other choice
case user.role_id
# admin and super admin should be able to see all courses
- Read upRead up
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Assignment Branch Condition size for get_questions_by_assignment is too high. [16.43/15] Open
def get_questions_by_assignment(assignment)
rubric = []
(0..assignment.rounds_of_reviews - 1).each do |round|
rubric[round] = nil
if assignment.varying_rubrics_by_round?
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Perceived complexity for delete is too high. [8/7] Open
def delete
# delete records in team, teams_users, signed_up_teams table
@team = Team.find_by(id: params[:id])
unless @team.nil?
course = Object.const_get(session[:team_type]).find(@team.parent_id)
- Read upRead up
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Assignment Branch Condition size for submitted_within_round? is too high. [16.79/15] Open
def submitted_within_round?(round, response_map, assignment_created, assignment_due_dates)
submission_due_date = assignment_due_dates.where(round: round, deadline_type_id: 1).try(:first).try(:due_at)
submission = SubmissionRecord.where(team_id: response_map.reviewee_id, operation: ['Submit File', 'Submit Hyperlink'])
subm_created_at = submission.where(created_at: assignment_created..submission_due_date)
if round > 1
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for list_review_submissions is too high. [16.82/15] Open
def list_review_submissions(participant_id, reviewee_team_id, response_map_id)
participant = Participant.find(participant_id)
team = AssignmentTeam.find(reviewee_team_id)
html = ''
if !team.nil? and !participant.nil?
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for send_email is too high. [16.4/15] Open
def send_email
proposer = User.find_by(id: @user_id)
if proposer
teams_users = TeamsUser.where(team_id: @team_id)
cc_mail_list = []
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for create_new_team is too high. [16.28/15] Open
def create_new_team
new_team = AssignmentTeam.create(name: 'Team_' + rand(10_000).to_s,
parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')
t_user = TeamsUser.create(team_id: new_team.id, user_id: @user_id)
SignedUpTeam.create(topic_id: @signuptopic.id, team_id: new_team.id, is_waitlisted: 0)
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Cyclomatic complexity for valid_quiz is too high. [7/6] Open
def valid_quiz
num_quiz_questions = Assignment.find(params[:aid]).num_quiz_questions
valid = "valid"
(1..num_quiz_questions).each do |i|
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Perceived complexity for inherit is too high. [8/7] Open
def inherit
assignment = Assignment.find(params[:id])
course = assignment.course
@copied_participants = []
if course
- Read upRead up
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points