Showing 2,813 of 2,813 total issues
Assignment Branch Condition size for sort_reviewer_by_review_volume_desc is too high. [33/15] Open
def sort_reviewer_by_review_volume_desc
@reviewers.each do |r|
r.overall_avg_vol,
r.avg_vol_in_round_1,
r.avg_vol_in_round_2,
- 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 list is too high. [25/7] Open
def list
@automated_metareview = AutomatedMetareview.new
# pass in the response id as a parameter
@response = Response.find_by(map_id: params[:id])
@automated_metareview.calculate_metareview_metrics(@response, params[: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 save_all_questions is too high. [33/15] Open
def save_all_questions
questionnaire_id = params[:id]
begin
if params[:save]
params[:question].each_pair do |k, v|
- 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 others_work is too high. [33.63/15] Open
def others_work
@participant = AssignmentParticipant.find(params[:id])
return unless current_user_id?(@participant.user_id)
@assignment = @participant.assignment
- 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 new_quiz is too high. [33.2/15] Open
def new_quiz
valid_request = true
@assignment_id = params[:aid] # creating an instance variable to hold the assignment id
@participant_id = params[:pid] # creating an instance variable to hold the participant id
assignment = Assignment.find(@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
Cyclomatic complexity for list is too high. [24/6] Open
def list
@automated_metareview = AutomatedMetareview.new
# pass in the response id as a parameter
@response = Response.find_by(map_id: params[:id])
@automated_metareview.calculate_metareview_metrics(@response, params[:id])
- 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.
Assignment Branch Condition size for find_delim_filename is too high. [33.23/15] Open
def find_delim_filename(delim_type, other_char, suffix = "")
if delim_type == "comma"
filename = params[:model] + params[:id] + suffix + ".csv"
delimiter = ","
elsif delim_type == "space"
- 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. [66/25] Open
describe "#average_score_for_row" do
it 'returns correct average score for all not nil scores' do
score1 = VmQuestionResponseScoreCell.new(5, '#D98880', 'Case_2_score_value1 = 5')
score2 = VmQuestionResponseScoreCell.new(4, '#CD6155', 'Case_2_score_value2 = 4')
score3 = VmQuestionResponseScoreCell.new(3, '#C0392B', 'Case_2_score_value3 = 3')
- 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. [66/25] Open
describe '#signup_as_instructor_action' do
context 'when user cannot be found' do
it 'shows an flash error message and redirects to assignment#edit page' do
allow(User).to receive(:find_by).with(name: 'no name').and_return(nil)
allow(User).to receive(:find).with(8).and_return(student)
- 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. [66/25] Open
describe 'Student can create quizzes and edit them', js: true do
before(:each) do
create_default_test_data 1
end
- 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. [65/25] Open
describe PasswordRetrievalController do
describe "password reset" do
it "create new entry in password_resets table" do
@user = User.new
@user.email = "example@example.edu"
- 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 copy is too high. [32.08/15] Open
def self.copy(assignment_id, user)
Assignment.record_timestamps = false
old_assign = Assignment.find(assignment_id)
new_assign = old_assign.dup
user.set_instructor(new_assign)
- 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 flash_msg is too high. [32.26/15] 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 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 assign_quiz_dynamically is too high. [32.42/15] Open
def assign_quiz_dynamically
begin
assignment = Assignment.find(params[:assignment_id])
reviewer = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id: assignment.id).first
if ResponseMap.where(reviewed_object_id: params[:questionnaire_id], reviewer_id: params[:participant_id]).first
- 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_calibration is too high. [32.5/15] Open
def add_calibration
participant = AssignmentParticipant.where(parent_id: params[:id], user_id: session[:user].id).first rescue nil
if participant.nil?
participant = AssignmentParticipant.create(parent_id: params[:id], user_id: session[:user].id, can_submit: 1, can_review: 1, can_take_quiz: 1, handle: 'handle')
end
- 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 assign_reviewers_for_team is too high. [32.26/15] 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
- 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 rename_selected_file is too high. [32.31/15] Open
def rename_selected_file
old_filename = params[:directories][params[:chk_files]] + "/" + params[:filenames][params[:chk_files]]
new_filename = params[:directories][params[:chk_files]] + "/" + FileHelper.sanitize_filename(params[:faction][:rename])
begin
raise "A file already exists in this directory with the name \"#{params[:faction][:rename]}\"" if File.exist?(new_filename)
- 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 show is too high. [32.7/15] Open
def show
if params[:id].nil? || ((current_user_role? == "Student") && (session[:user].id != params[:id].to_i))
redirect_to(action: AuthHelper.get_home_action(session[:user]), controller: AuthHelper.get_home_controller(session[:user]))
else
@user = User.find(params[: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 exportdetails is too high. [32.57/15] Open
def exportdetails
@delim_type = params[:delim_type2]
filename, delimiter = find_delim_filename(@delim_type, params[:other_char2], "_Details")
allowed_models = ['Assignment']
- 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 json_generator is too high. [32.16/15] Open
def json_generator(assignment_id, another_assignment_id = 0, round_num = 2, type = 'peer review grades')
assignment = Assignment.find_by(id: assignment_id)
has_topic = !SignUpTopic.where(assignment_id: assignment_id).empty?
if type == 'peer review grades'
- 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