Showing 431 of 4,497 total issues
File response_analytic_spec.rb
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ResponseAnalyticTestDummyClass
attr_accessor :scores
require 'analytic/response_analytic'
include ResponseAnalytic
Class Team
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Team < ApplicationRecord
has_many :teams_users, dependent: :destroy
has_many :users, through: :teams_users
has_many :join_team_requests, dependent: :destroy
has_one :team_node, foreign_key: :node_object_id, dependent: :destroy
File scoring_spec.rb
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
describe Scoring do
include Scoring
let(:assignment_helper) { Class.new { extend AssignmentHelper } }
let(:questionnaire) { create(:questionnaire, id: 1) }
let(:question1) { create(:question, questionnaire: questionnaire, weight: 1, id: 1) }
File team_spec.rb
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
describe Team do
let(:assignment) { build(:assignment, id: 1, name: 'no assgt') }
let(:participant) { build(:participant, user_id: 1) }
let(:participant2) { build(:participant, user_id: 2) }
let(:participant3) { build(:participant, user_id: 3) }
File teams_users_controller_spec.rb
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
require './spec/support/teams_shared.rb'
describe TeamsUsersController do
# Including the stubbed objects from the teams_shared.rb file
include_context 'object initializations'
Method feedback_response_report
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def self.feedback_response_report(id, _type)
# Example query
# SELECT distinct reviewer_id FROM response_maps where type = 'FeedbackResponseMap' and
# reviewed_object_id in (select id from responses where
# map_id in (select id from response_maps where reviewed_object_id = 722 and type = 'ReviewResponseMap'))
- 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
Function toggleTeams
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
function toggleTeams(numteams, visible) {
for (var i = 0; i < numteams; i++) {
var sublistsize = 1;
var elementId = 'team' + i;
var obj = document.getElementById(elementId + '_' + sublistsize);
- 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
Function NewCal
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
function NewCal(pCtrl,pFormat,pShowTime,pTimeMode)
{
Cal=new Calendar(dtToday);
if ((pShowTime!=null) && (pShowTime))
{
Class StudentTask
has 25 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 AssignmentParticipant
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class AssignmentParticipant < Participant
belongs_to :assignment, class_name: 'Assignment', foreign_key: 'parent_id'
has_many :review_mappings, class_name: 'ReviewResponseMap', foreign_key: 'reviewee_id'
has_many :response_maps, foreign_key: 'reviewee_id'
has_many :quiz_mappings, class_name: 'QuizResponseMap', foreign_key: 'reviewee_id'
Method items_for_permissions
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def self.items_for_permissions(permission_ids = nil)
if permission_ids
perms = {}
permission_ids.each { |id| perms[id] = true }
end
- 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
Function toggleList
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function toggleList(elementId,listSize) {
if (listSize == 0) {return;}
for (var i = 1; i <= listSize; i++){
var obj = document.getElementById(elementId+"_"+i);
if (obj == null) { return; }
- 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 three_node_cycles
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def three_node_cycles(assignment_participant)
collusion_cycles = []
assignment_participant.reviewers.each do |ap1|
ap1.reviewers.each do |ap2|
next unless ap2.reviewers.include?(assignment_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
Method hash_rows_with_headers
has a Cognitive Complexity of 20 (exceeds 5 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|
- 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 ResponseController
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class ResponseController < ApplicationController
include AuthorizationHelper
include ResponseHelper
helper :submitted_content
Class ReputationWebServiceController
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class ReputationWebServiceController < ApplicationController
include AuthorizationHelper
# Method: action_allowed
# This method checks if the currently authenticated user has the authorization
Class ApplicationController
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
include AccessHelper
# You want to get exceptions in development, but not in production.
unless Rails.application.config.consider_all_requests_local
File assignment_participant_spec.rb
has 276 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]) }
Function dateFormat
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
var dateFormat = function () {
var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
timezoneClip = /[^-+\dA-Z]/g,
pad = function (val, len) {
Method update_due_dates
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def update_due_dates(attributes, user)
return false unless attributes
attributes.each do |due_date|
next if due_date[:due_at].blank?
- 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"