Showing 2,813 of 2,813 total issues
Perceived complexity for view_completed_question is too high. [16/7] Open
def view_completed_question(count, answer, questionnaire_max, tag_prompt_deployments = nil, current_user = nil)
html = '<b>' + count.to_s + ". " + self.txt + ' [Max points: ' + questionnaire_max.to_s + "]</b>"
score = answer && !answer.answer.nil? ? answer.answer.to_s : "-"
score_percent = if score != "-"
- 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 compute_assignment_score is too high. [24.6/15] Open
def compute_assignment_score(questions, scores)
self.assignment.questionnaires.each do |questionnaire|
round = AssignmentQuestionnaire.find_by(assignment_id: self.assignment.id, questionnaire_id: questionnaire.id).used_in_round
# create symbol for "varying rubrics" feature -Yang
questionnaire_symbol = if round.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 assignment_questionnaire is too high. [24.74/15] Open
def assignment_questionnaire(assignment, type, number)
questionnaire = assignment.questionnaires.find_by(type: type)
if questionnaire.nil?
default_weight = {}
- 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_questions_from_csv is too high. [16/7] 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 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 create is too high. [24.76/15] Open
def create
@join_team_request = JoinTeamRequest.new
@join_team_request.comments = params[:comments]
@join_team_request.status = 'P'
@join_team_request.team_id = params[: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
Assignment Branch Condition size for delete_metareviewer is too high. [24.35/15] Open
def delete_metareviewer
mapping = MetareviewResponseMap.find(params[:id])
assignment_id = mapping.assignment.id
flash[:note] = "The metareview mapping for " + mapping.reviewee.name + " and " + mapping.reviewer.name + " has been deleted."
- 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 calcutate_average_author_feedback_score is too high. [24.29/15] Open
def calcutate_average_author_feedback_score(assignment_id, max_team_size, response_map_id, reviewee_id)
review_response = ResponseMap.where(id: response_map_id).try(:first).try(:response).try(:last)
author_feedback_avg_score = "-- / --"
unless review_response.nil?
user = TeamsUser.where(team_id: reviewee_id).try(:first).try(:user) if max_team_size == 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 is too high. [24.1/15] Open
def list
allowed_types = %w[Assignment Course]
session[:team_type] = params[:type] if params[:type] && allowed_types.include?(params[:type])
@assignment = Assignment.find_by(id: params[:id]) if session[:team_type] == 'Assignment'
begin
- 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 assign_reviewer_dynamically is too high. [16/7] Open
def assign_reviewer_dynamically
assignment = Assignment.find(params[:assignment_id])
reviewer = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id: assignment.id).first
if params[:i_dont_care].nil? && params[:topic_id].nil? && assignment.topics? && assignment.can_choose_topic_to_review?
- 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 validate_optional_conf is too high. [24.84/15] Open
def self.validate_optional_conf(optionalConf, template)
if optionalConf[:subtitle].nil?
template.delete(:subtitle)
else
template[:subtitle] = {}
- 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 is too high. [24.62/15] Open
def view
StudentTask.from_participant_id params[:id]
@participant = AssignmentParticipant.find(params[:id])
@can_submit = @participant.can_submit
@can_review = @participant.can_review
- 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 impersonate is too high. [15/6] Open
def impersonate
if params[:user]
message = "No user exists with the name '#{params[:user][:name]}'."
elsif params[:impersonate]
message = "No user exists with the name '#{params[:impersonate][:name]}'."
- 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 new is too high. [24.7/15] Open
def new
assign_instance_vars
set_content(true)
@stage = @assignment.get_current_stage(SignedUpTeam.topic_id(@participant.parent_id, @participant.user_id)) if @assignment
# Because of the autosave feature and the javascript that sync if two reviewing windows are opened
- 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 hash_rows_with_headers is too high. [15/6] Open
def hash_rows_with_headers(header, body)
new_body = []
if params[:model] == "User" or params[:model] == "AssignmentParticipant" or params[:model] == "CourseParticipant" or params[:model] == "SignUpTopic"
# header.map! { |column_name| column_name.to_sym }
header.map!(&:to_sym)
- 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.
Method impersonate
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
def impersonate
if params[:user]
message = "No user exists with the name '#{params[:user][:name]}'."
elsif params[:impersonate]
message = "No user exists with the name '#{params[:impersonate][:name]}'."
Class StudentTask
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class StudentTask
attr_accessor :assignment, :current_stage, :participant, :stage_deadline, :topic
def initialize(args)
@assignment = args[:assignment]
Class ReviewMappingController
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class ReviewMappingController < ApplicationController
autocomplete :user, :name
# use_google_charts
require 'gchart'
# helper :dynamic_review_assignment
Block has too many lines. [53/25] Open
teams.each do |team|
selected_participants = []
if !team.equal? teams.last
# need to even out the # of reviews for teams
while selected_participants.size < review_strategy.reviews_per_team
- 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. [53/25] Open
describe "#test compute scores" do
let(:response1) { double("respons1") }
let(:response2) { double("respons2") }
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.
Block has too many lines. [53/25] Open
describe CourseController do
let(:instructor) { build(:instructor, id: 6) }
let(:student) { build(:student) }
let(:course) { double('Course', instructor_id: 6, path: '/cscs', name: 'abc') }
describe '#action_allowed?' 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.