Showing 2,813 of 2,813 total issues
Assignment Branch Condition size for import is too high. [44.99/15] Open
def self.import(row_hash, id, options, teamtype)
raise ArgumentError, "Not enough fields on this line." if row_hash.empty? || (row_hash[:teammembers].length < 2 && (options[:has_teamname] == "true_first" || options[:has_teamname] == "true_last")) || (row_hash[:teammembers].empty? && (options[:has_teamname] == "true_first" || options[:has_teamname] == "true_last"))
if options[:has_teamname] == "true_first" || options[:has_teamname] == "true_last"
name = row_hash[:teamname].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 randomize_all_by_parent is too high. [44.11/15] Open
def self.randomize_all_by_parent(parent, team_type, min_team_size)
participants = Participant.where(parent_id: parent.id, type: parent.class.to_s + "Participant")
participants = participants.sort { rand(-1..1) }
users = participants.map {|p| User.find(p.user_id) }.to_a
# find teams still need team members and users who are not in any team
- 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_reviews is too high. [44.68/15] 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
- 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 concatenate_all_review_comments is too high. [44.33/15] Open
def self.concatenate_all_review_comments(assignment_id, reviewer_id)
comments = ''
counter = 0
@comments_in_round1 = @comments_in_round2 = @comments_in_round3 = ''
@counter_in_round1 = @counter_in_round2 = @counter_in_round3 = 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
Assignment Branch Condition size for add_reviewer is too high. [44.25/15] Open
def add_reviewer
assignment = Assignment.find(params[:id])
topic_id = params[:topic_id]
user_id = User.where(name: params[:user][:name]).first.id
# If instructor want to assign one student to review his/her own artifact,
- 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 summarize_reviews_by_reviewee is too high. [44.61/15] Open
def summarize_reviews_by_reviewee(questions, assignment, r_id, summary_ws_url)
self.summary = ({})
self.avg_scores_by_round = ({})
self.avg_scores_by_criterion = ({})
- 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_requested_user_record is too high. [44.67/15] Open
def create_requested_user_record
requested_user = RequestedUser.new(requested_user_params)
if params[:user][:institution_id].empty?
institution = Institution.find_or_create_by(name: params[:institution][:name])
requested_user.institution_id = institution.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 set_priority is too high. [44.03/15] Open
def set_priority
participant = AssignmentParticipant.find_by(id: params[:participant_id])
assignment_id = SignUpTopic.find(params[:topic].first).assignment.id
team_id = participant.team.try(:id)
unless team_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
File user_spec.rb
has 376 lines of code (exceeds 250 allowed). Consider refactoring. Open
describe User do
let(:user) do
User.new name: 'abc', fullname: 'abc xyz', email: 'abcxyz@gmail.com', password: '12345678', password_confirmation: '12345678',
email_on_submission: 1, email_on_review: 1, email_on_review_of_review: 0, copy_of_emails: 1, handle: 'handle'
end
Assignment Branch Condition size for import is too high. [43.23/15] Open
def self.import(row, _row_header, session, _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 seperated with the delimiter), and your email."
end
questionnaire = Questionnaire.find_by_id(_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 view_question_text is too high. [43.73/15] Open
def view_question_text
html = '<TD align="left"> ' + self.txt + ' </TD>'
html += '<TD align="left">' + self.type + '</TD>'
html += '<td align="center">' + self.weight.to_s + '</TD>'
questionnaire = self.questionnaire
- 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_sub_directories is too high. [43.22/15] 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 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 get_questions_from_csv is too high. [43.3/15] Open
def self.get_questions_from_csv(questionnaire, file)
questions = []
custom_rubric = questionnaire.section == "Custom"
CSV::Reader.parse(file) do |row|
- 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_password is too high. [43.67/15] Open
def send_password
if params[:user][:email].nil? || params[:user][:email].strip.empty?
flash[:error] = "Please enter an e-mail address."
else
user = User.find_by(email: params[:user][:email])
- 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 update_password is too high. [43.61/15] Open
def update_password
if params[:reset][:password] == params[:reset][:repassword]
user = User.find_by(email: params[:reset][:email])
user.password = params[:reset][:password]
user.password_confirmation = params[:reset][:repassword]
- 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
File users_controller_spec.rb
has 372 lines of code (exceeds 250 allowed). Consider refactoring. Open
describe UsersController do
let(:admin) { build(:admin, id: 3) }
let(:super_admin) {build (:superadmin)}
let(:instructor) { build(:instructor, id: 2) }
let(:student1) { build(:student, id: 1, name: :lily) }
File assignment_particpant_spec.rb
has 371 lines of code (exceeds 250 allowed). Consider refactoring. Open
describe AssignmentParticipant do
let(:response) { build(:response) }
let(:team) { build(:assignment_team, id: 1) }
let(:team2) { build(:assignment_team, id: 2) }
let(:response_map) { build(:review_response_map, reviewer_id: 2, response: [response]) }
Block has too many lines. [79/25] Open
keys.each_with_index do |key, round|
next if @sentiment_summary[round].nil?
content = []
v_label = []
h_label = []
- 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. [79/25] Open
context 'when the reviewers of current reviewer (ap3) includes current assignment participant' do
# This before-each function is used to extract out re-appearing code used in four_node_cycle tests
# More specifically, it is used to extract out the common code used to
# create a relationship between four revewing participants
before(:each) 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.
Assignment Branch Condition size for get_total_score is too high. [42.37/15] Open
def self.get_total_score(params)
@response = params[:response].last
if @response
@questions = params[:questions]
- 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