Showing 431 of 4,497 total issues
File tree_display.jsx
has 1392 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// initialize a global object available throughout the application
// can be useful on different pages
let app_variables = {
currentUserId: null,
File review_mapping_helper_spec.rb
has 798 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require 'spec_helper'
require 'rails_helper'
describe ReviewMappingHelper, type: :helper do
let(:team) { build(:assignment_team, id: 1) }
File assignment_form_spec.rb
has 740 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
describe AssignmentForm do
let(:assignment) { build(:assignment, id: 1) }
let(:due_date) { build(:assignment_due_date) }
let(:assignment_form) { AssignmentForm.new }
let(:user) { double('Instructor', timezonepref: 'Eastern Time (US & Canada)') }
File sign_up_sheet_controller_spec.rb
has 723 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
describe SignUpSheetController do
let(:assignment) { build(:assignment, id: 1, instructor_id: 6, due_dates: [due_date], microtask: true, staggered_deadline: true, directory_path: 'assignment') }
let(:assignment2) { create(:assignment, id: 2, microtask: false, staggered_deadline: false, private: true, directory_path: 'assignment2') }
let(:assignment3) { create(:assignment, id: 3, microtask: true, staggered_deadline: true, private: false, directory_path: 'assignment3') }
let(:assignment30) { create(:assignment, id: 30, microtask: true, staggered_deadline: false, private: true, directory_path: 'assignment30') }
Function render
has 321 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function() {
var _rows = []
var _this = this
var colWidthArray = [ '30%', '0%', '0%', '0%', '25%', '25%', '20%' ]
var colDisplayStyle = {
File factories.rb
has 678 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
FactoryBot.define do
factory :institution, class: Institution do
name 'North Carolina State University'
end
File assignment_spec.rb
has 659 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
describe Assignment do
let(:assignment) { build(:assignment, id: 1, name: 'no assignment', participants: [participant], teams: [team], max_team_size: 2) }
let(:instructor) { build(:instructor, id: 6) }
let(:student) { build(:student, id: 3, name: 'no one') }
let(:review_response_map) { build(:review_response_map, response: [response], reviewer: build(:participant), reviewee: build(:assignment_team)) }
File assignment_creation_spec.rb
has 632 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
def questionnaire_options(type)
questionnaires = Questionnaire.where(['private = 0 or instructor_id = ?', session[:user].id]).order('name')
options = []
questionnaires.select { |x| x.type == type }.each do |questionnaire|
options << [questionnaire.name, questionnaire.id]
File review_mapping_controller_spec.rb
has 625 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require 'rails_helper'
describe ReviewMappingController do
let(:assignment) { double('Assignment', id: 1) }
let(:reviewer) { double('Participant', id: 1, name: 'reviewer') }
let(:review_response_map) do
Method peer_review_strategy
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
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
File authorization_helper_spec.rb
has 520 lines of code (exceeds 250 allowed). Consider refactoring. Open
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
File assignment.rb
has 491 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class Assignment < ApplicationRecord
require 'analytic/assignment_analytic'
include Scoring
include AssignmentAnalytic
include ReviewAssignment
Class Assignment
has 54 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Assignment < ApplicationRecord
require 'analytic/assignment_analytic'
include Scoring
include AssignmentAnalytic
include ReviewAssignment
Function methods
has 187 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var methods = (function () {
// private properties and methods go here
var c = {
bcClass: 'sf-breadcrumb',
menuClass: 'sf-js-enabled',
File review_mapping_controller.rb
has 471 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class ReviewMappingController < ApplicationController
include AuthorizationHelper
autocomplete :user, :name
# helper :dynamic_review_assignment
Class AssignmentsController
has 48 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class AssignmentsController < ApplicationController
include AssignmentHelper
include AuthorizationHelper
autocomplete :user, :name
before_action :authorize
File datetimepicker.js
has 439 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
//Javascript name: My Date Time Picker
//Date created: 16-Nov-2003 23:19
//Scripter: TengYong Ng
//Website: http://www.rainforestnet.com
//Copyright (c) 2003 TengYong Ng
File assignments_controller_spec.rb
has 419 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
describe AssignmentsController do
let(:assignment) do
build(:assignment, id: 1, name: 'test assignment', instructor_id: 6, staggered_deadline: true, directory_path: 'test_assignment',
participants: [build(:participant)], teams: [build(:assignment_team)], course_id: 1)
end
File user_spec.rb
has 413 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
describe User do
let(:user) do
User.new name: 'abc', fullname: 'abc xyz', email: 'abcxyz@gmail.com', password: '12345678', password_confirmation: '12345678',
email_on_submission: 1, email_on_review: 1, email_on_review_of_review: 0, copy_of_emails: 1, handle: 'handle'
end
Method import_from_hash
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
Open
def import_from_hash(session, params)
if (params[:model] == 'AssignmentTeam') || (params[:model] == 'CourseTeam')
contents_hash = eval(params[:contents_hash])
@header_integrated_body = hash_rows_with_headers(contents_hash[:header], contents_hash[:body])
errors = []
- 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"