Showing 2,813 of 2,813 total issues
Block has too many lines. [71/25] Open
describe "rubrics tab", js: true do
before(:each) do
@assignment = create(:assignment)
create_list(:participant, 3)
# Create an assignment due date
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
Method complete
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
def complete(count, answer = nil, questionnaire_min, questionnaire_max, dropdown_or_scale)
if self.size.nil?
cols = '70'
rows = '1'
else
Assignment Branch Condition size for complete is too high. [36.37/15] Open
def complete(count, answer = nil)
if self.size.nil?
cols = '70'
rows = '1'
elsif
- 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 complete is too high. [36.52/15] Open
def complete(count, answer = nil)
html = '<p style="width: 80%;">'
html += '<label for="responses_' + count.to_s + '" >' + self.txt + ' </label>'
html += '<input id="responses_' + count.to_s + '_score" name="responses[' + count.to_s + '][score]" type="hidden" value="" ">'
html += '<input id="responses_' + count.to_s + '_comments" label=' + self.txt + ' name="responses[' + count.to_s + '][comment]" style="width: 40%;" size=' + self.size.to_s + ' type="text"'
- 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 change_handle is too high. [36.18/15] Open
def change_handle
@participant = AssignmentParticipant.find(params[:id])
return unless current_user_id?(@participant.user_id)
unless params[:participant].nil?
if !AssignmentParticipant.where(parent_id: @participant.parent_id, handle: params[:participant][:handle]).empty?
- 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 copy_questionnaire_details is too high. [36.4/15] Open
def copy_questionnaire_details(questions, orig_questionnaire)
@questionnaire.instructor_id = assign_instructor_id
@questionnaire.name = 'Copy of ' + orig_questionnaire.name
begin
@questionnaire.created_at = Time.now
- 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 is too high. [36.89/15] Open
def create
if params[:assignment_id].nil?
flash[:error] = "Missing assignment:" + params[:assignment_id]
return
elsif params[:questionnaire_id].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 edit_params_setting is too high. [36.67/15] Open
def edit_params_setting
@assignment = Assignment.find(params[:id])
@num_submissions_round = @assignment.find_due_dates('submission').nil? ? 0 : @assignment.find_due_dates('submission').count
@num_reviews_round = @assignment.find_due_dates('review').nil? ? 0 : @assignment.find_due_dates('review').count
- 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 signup_as_instructor_action is too high. [36.47/15] Open
def signup_as_instructor_action
user = User.find_by(name: params[:username])
if user.nil? # validate invalid user
flash[:error] = "That student does not exist!"
else
- 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
Block has too many lines. [70/25] Open
describe "CourseParticipant" do
describe "#copy" do
before(:each) do
@assignment = build(:assignment)
@course_participant = build(:course_participant)
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
Block has too many lines. [70/25] Open
describe InvitationsController do
let(:instructor) { build(:instructor, id: 6) }
let(:student) { build(:student) }
let(:admin) { build(:admin) }
let(:ta) { build(:teaching_assistant, id: 8) }
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
Method import_from_hash
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import_from_hash(session, params)
contents_hash = eval(params[:contents_hash])
if params[:model] == "AssignmentTeam" or params[:model] == "CourseTeam"
# contents_hash = eval(params[:contents_hash])
@header_integrated_body = hash_rows_with_headers(contents_hash[:header], contents_hash[:body])
Assignment Branch Condition size for import is too high. [35.94/15] Open
def self.import(row_hash, _session, assignment_id)
reviewee_user_name = row_hash[:reviewee].to_s
reviewee_user = User.find_by(name: reviewee_user_name)
raise ArgumentError, "Cannot find reviewee user." unless reviewee_user
reviewee_participant = AssignmentParticipant.find_by(user_id: reviewee_user.id, parent_id: assignment_id)
- 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 export_data is too high. [35.5/15] Open
def self.export_data(csv, scores, options)
@scores = scores
(0..@scores[:teams].length - 1).each do |index|
team = @scores[:teams][index.to_s.to_sym]
first_participant = team[:team].participants[0] unless team[:team].participants[0].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 add_new_questions is too high. [35.48/15] Open
def add_new_questions
questionnaire_id = params[:id] unless params[:id].nil?
num_of_existed_questions = Questionnaire.find(questionnaire_id).questions.size
((num_of_existed_questions + 1)..(num_of_existed_questions + params[:question][:total_num].to_i)).each do |i|
question = Object.const_get(params[:question][:type]).create(txt: '', questionnaire_id: questionnaire_id, seq: i, type: params[:question][:type], break_before: true)
- 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 add_ta is too high. [35.75/15] Open
def add_ta
@course = Course.find(params[:course_id])
@user = User.find_by(name: params[:user][:name])
if @user.nil?
flash.now[:error] = "The user inputted \"" + params[:user][:name] + "\" does not exist."
- 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
Block has too many lines. [69/25] Open
describe VmQuestionResponseRow do
let(:row){ VmQuestionResponseRow.new('Question for testing average score', 1, 1, 5, 1)}
describe "#average_score_for_row" do
it 'returns correct average score for all not nil scores' do
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
Block has too many lines. [69/25] Open
describe OnTheFlyCalc do
let(:on_the_fly_calc) { Class.new { extend OnTheFlyCalc } }
let(:questionnaire) { create(:questionnaire, id: 1) }
let(:question1) { create(:question, questionnaire: questionnaire, weight: 1, id: 1) }
let(:response) { build(:response, id: 1, map_id: 1, scores: [answer]) }
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
File assignments_controller_spec.rb
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
describe AssignmentsController do
let(:assignment) do
build(:assignment, id: 1, name: 'test assignment', instructor_id: 6, staggered_deadline: true, directory_path: 'same path',
participants: [build(:participant)], teams: [build(:assignment_team)], course_id: 1)
end
File review_mapping_helper.rb
has 332 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ReviewMappingHelper
def create_report_table_header(headers = {})
table_header = "<div class = 'reviewreport'>\
<table width='100% cellspacing='0' cellpadding='2' border='0' class='table table-striped'>\
<tr bgcolor='#CCCCCC'>"