Showing 4,502 of 4,502 total issues
Module has too many lines. [113/100] Open
module ReviewAssignment
def contributors
# ACS Contributors are just teams, so removed check to see if it is a team assignment
@contributors ||= teams # ACS
end
- Read upRead up
- Exclude checks
This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method peer_review_strategy
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
def peer_review_strategy(assignment_id, review_strategy, participants_hash)
teams = review_strategy.teams
participants = review_strategy.participants
num_participants = participants.size
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Class has too many lines. [110/100] Open
class BookmarksController < ApplicationController
include AuthorizationHelper
include Scoring
helper_method :specific_average_score
helper_method :total_average_score
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for team_users_popup is too high. [77.83/15] Open
def team_users_popup
@ip = session[:ip]
@sum = 0
@team = Team.find(params[:id])
@assignment = Assignment.find(@team.parent_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
Class has too many lines. [109/100] Open
class StudentQuizzesController < ApplicationController
include AuthorizationHelper
def action_allowed?
if current_user_is_a? 'Student'
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Block has too many lines. [127/25] Open
describe 'assignment submisstion test' do
before(:each) do
# create assignment and topic
create(:assignment, name: 'Assignment1684', directory_path: 'Assignment1684')
create_list(:participant, 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.
Class has too many lines. [108/100] Open
class SiteControllersController < ApplicationController
include AuthorizationHelper
def action_allowed?
current_user_has_super_admin_privileges?
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for course_options is too high. [76.56/15] Open
def course_options(instructor = nil)
courses = []
if session[:user].role.name == 'Teaching Assistant'
ta = Ta.find(session[:user].id)
ta.ta_mappings.each { |mapping| courses << Course.find(mapping.course_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 edit is too high. [75.3/15] Open
def edit
quiz_question_choices = QuizQuestionChoice.where(question_id: id)
html = '<tr><td>'
html += '<textarea cols="100" name="question[' + id.to_s + '][txt]" '
- 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. [124/25] Open
describe CourseTeam do
let(:course) { build(:course, id: 1, name: 'ECE517') }
let(:course_team1) { build(:course_team, id: 1) }
let(:course_team2) { build(:course_team, id: 2) }
let(:instructor) { build(:instructor, id: 6) }
- 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. [124/25] Open
describe MetareviewResponseMap do
let(:team) { build(:assignment_team, id: 1, name: 'team no name', assignment: assignment, users: [student], parent_id: 1) }
let(:team2) { build(:assignment_team, id: 3, name: 'no team') }
let(:team1) { build(:assignment_team, id: 2, name: 'team has name', assignment: assignment, users: [student]) }
let(:team3) { build(:assignment_team, id: 4, name: 'team has name1', assignment: assignment, users: [student1]) }
- 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.
Class has too many lines. [104/100] Open
class Question < ApplicationRecord
belongs_to :questionnaire # each question belongs to a specific questionnaire
belongs_to :review_of_review_score # ditto
has_many :question_advices, dependent: :destroy # for each question, there is separate advice about each possible score
has_many :signup_choices # ?? this may reference signup type questionnaires
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Module has too many lines. [104/100] Open
module ParticipantsHelper
# separates the file into the necessary elements to create a new user
def self.upload_users(filename, session, params, home_page)
users = []
File.open(filename, 'r') do |infile|
- Read upRead up
- Exclude checks
This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for complete is too high. [74.42/15] Open
def complete(count, questionnaire_min, questionnaire_max, answer = nil)
html = '<div><label for="responses_' + count.to_s + '">' + txt + '</label></div>'
html += '<input id="responses_' + count.to_s + '_score" name="responses[' + count.to_s + '][score]" type="hidden"'
html += 'value="' + answer.answer.to_s + '"' unless answer.nil?
html += '>'
- 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
Module has too many lines. [103/100] Open
module SubmittedContentHelper
def display_directory_tree(participant, files, display_to_reviewer_flag)
index = 0
participant = @participant if @participant
assignment = participant.assignment # participant is @map.contributor
- Read upRead up
- Exclude checks
This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Class has too many lines. [103/100] Open
class Mailer < ActionMailer::Base
if Rails.env.development? || Rails.env.test?
default from: 'expertiza.mailer@gmail.com'
else
default from: 'expertiza.mailer@gmail.com'
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Block has too many lines. [123/25] Open
describe Invitation do
let(:user2) { build(:student, id: 2) }
let(:user3) { build(:student, id: 3) }
let(:assignment) { build(:assignment, id: 1) }
let(:team) { build(:assignment_team, id: 1, parent_id: 1) }
- 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 authorization_helper_spec.rb
has 520 lines of code (exceeds 250 allowed). Consider refactoring. Open
describe AuthorizationHelper do
# Set up some dummy users
# Inspired by spec/controllers/users_controller_spec.rb
# Makes use of spec/factories/factories.rb
# Use create instead of build so that these users get IDs
Assignment Branch Condition size for edit is too high. [73.39/15] Open
def edit(_count)
html = '<tr>'
html += '<td align="center"><a rel="nofollow" data-method="delete" href="/questions/' + id.to_s + '">Remove</a></td>'
html += '<td><input size="6" value="' + seq.to_s + '" name="question[' + id.to_s + '][seq]" id="question_' + id.to_s
html += '_seq" type="text"></td><td><textarea cols="50" rows="1" name="question[' + id.to_s + '][txt]" id="question_' + id.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 calculate_score is too high. [73.11/15] Open
def calculate_score(map, response)
questionnaire = Questionnaire.find(map.reviewed_object_id)
scores = []
valid = true
questions = Question.where(questionnaire_id: questionnaire.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