Showing 431 of 4,497 total issues
Method render_participant_info
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def render_participant_info(topic, assignment, participants)
html = ''
if participants.present?
chooser_present = false
participants.each do |participant|
- 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
File impersonate_controller_spec.rb
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
describe ImpersonateController do
let(:instructor) { build(:instructor, id: 2) }
let(:student1) { build(:student, id: 30, name: :Amanda) }
let(:student2) { build(:student, id: 40, name: :Brian) }
let(:admin) { build(:admin, id: 3, name: :Admin) }
File collusion_cycle_spec.rb
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
describe CollusionCycle do
#
# assignment participant -----
# ^ |
# | V
Function componentWillMount
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
componentWillMount: function() {
var _this = this
preloadImages(
'/assets/tree_view/edit-icon-24.png',
'/assets/tree_view/delete-icon-24.png',
Method process_translation
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def process_translation(contents, key, val)
replacements = []
skips = []
resume_index = 0
while resume_index < contents.length
- 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
Method list
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def list
@participant = AssignmentParticipant.find(params[:id].to_i)
@assignment = @participant.assignment
@slots_filled = SignUpTopic.find_slots_filled(@assignment.id)
@slots_waitlisted = SignUpTopic.find_slots_waitlisted(@assignment.id)
- 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
Method classify_controllers
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def classify_controllers
from_classes = SiteController.classes
from_db = SiteController.order(:name)
known = {}
- 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
File import_file_controller.rb
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ImportFileController < ApplicationController
include AuthorizationHelper
def action_allowed?
current_user_has_ta_privileges?
Class Role
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Role < ApplicationRecord
belongs_to :parent, class_name: 'Role', inverse_of: false
has_many :users, inverse_of: false, dependent: :nullify
serialize :cache
Method display_volume_metric_chart
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def display_volume_metric_chart(reviewer)
labels, reviewer_data, all_reviewers_data = initialize_chart_elements(reviewer)
data = {
labels: labels,
datasets: [
Method peer_review_strategy
has 57 lines of code (exceeds 25 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
Method assessments_for
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def self.assessments_for(team)
responses = []
# stime = Time.now
if team
@array_sort = []
- 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
Method view_completed_question
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def view_completed_question(count, answer, questionnaire_max, tag_prompt_deployments = nil, current_user = nil)
html = '<b>' + count.to_s + '. ' + txt + ' [Max points: ' + questionnaire_max.to_s + ']</b>'
score = answer && !answer.answer.nil? ? answer.answer.to_s : '-'
score_percent = score != '-' ? answer.answer * 1.0 / questionnaire_max : 0
score_color = if score_percent > 0.8
- 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
Method automatic_review_mapping
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def automatic_review_mapping
assignment_id = params[:id].to_i
assignment = Assignment.find(params[:id])
participants = AssignmentParticipant.where(parent_id: params[:id].to_i).to_a.select(&:can_review).shuffle!
teams = AssignmentTeam.where(parent_id: params[:id].to_i).to_a.shuffle!
- 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
Method hash_rows_with_headers
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def hash_rows_with_headers(header, body)
new_body = []
if (params[:model] == 'User') || (params[:model] == 'AssignmentParticipant') || (params[:model] == 'CourseParticipant') || (params[:model] == 'SignUpTopic')
header.map! { |str| str.strip.downcase.gsub(/\s+/, "").to_sym }
body.each do |row|
File tree_display_controller.rb
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
class TreeDisplayController < ApplicationController
helper :application
include SecurityHelper
include AuthorizationHelper
File review_response_map_spec.rb
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
describe ReviewResponseMap 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]) }
Method create
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
user = User.find_by(name: params[:user][:name].strip)
unless user
urlCreate = url_for controller: 'users', action: 'new'
flash[:error] = "\"#{params[:user][:name].strip}\" is not defined. Please <a href=\"#{urlCreate}\">create</a> this user before continuing."
Method assignment_tagging_progress
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def assignment_tagging_progress
teams = Team.where(parent_id: assignment_id)
questions = Question.where(questionnaire_id: questionnaire.id, type: question_type)
questions_ids = questions.map(&:id)
user_answer_tagging = []
- 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
Method add_table_rows
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def add_table_rows(questionnaire_max, questions, answers, code, tag_prompt_deployments = nil, current_user = nil)
count = 0
# loop through questions so the the questions are displayed in order based on seq (sequence number)
questions.each do |question|
count += 1 if !question.is_a?(QuestionnaireHeader) && (question.break_before == true)
- 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"