expertiza/expertiza

View on GitHub

Showing 431 of 4,497 total issues

File tree_display.jsx has 1392 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// initialize a global object available throughout the application
// can be useful on different pages
let app_variables = {

  currentUserId: null,
Severity: Major
Found in app/assets/javascripts/tree_display.jsx - About 3 days to fix

    File review_mapping_helper_spec.rb has 798 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'spec_helper'
    require 'rails_helper'
    
    describe ReviewMappingHelper, type: :helper do
      let(:team) { build(:assignment_team, id: 1) }
    Severity: Major
    Found in spec/helpers/review_mapping_helper_spec.rb - About 1 day to fix

      File assignment_form_spec.rb has 740 lines of code (exceeds 250 allowed). Consider refactoring.
      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)') }
      Severity: Major
      Found in spec/models/assignment_form_spec.rb - About 1 day to fix

        File sign_up_sheet_controller_spec.rb has 723 lines of code (exceeds 250 allowed). Consider refactoring.
        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') }
        Severity: Major
        Found in spec/controllers/sign_up_sheet_controller_spec.rb - About 1 day to fix

          Function render has 321 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              render: function() {
                var _rows = []
                var _this = this
                var colWidthArray = [ '30%', '0%', '0%', '0%', '25%', '25%', '20%' ]
                var colDisplayStyle = {
          Severity: Major
          Found in app/assets/javascripts/tree_display.jsx - About 1 day to fix

            File factories.rb has 678 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            FactoryBot.define do
              factory :institution, class: Institution do
                name 'North Carolina State University'
              end
            
            
            Severity: Major
            Found in spec/factories/factories.rb - About 1 day to fix

              File assignment_spec.rb has 659 lines of code (exceeds 250 allowed). Consider refactoring.
              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)) }
              Severity: Major
              Found in spec/models/assignment_spec.rb - About 1 day to fix

                File assignment_creation_spec.rb has 632 lines of code (exceeds 250 allowed). Consider refactoring.
                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]
                Severity: Major
                Found in spec/features/assignment_creation_spec.rb - About 1 day to fix

                  File review_mapping_controller_spec.rb has 625 lines of code (exceeds 250 allowed). Consider refactoring.
                  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
                  Severity: Major
                  Found in spec/controllers/review_mapping_controller_spec.rb - About 1 day to fix

                    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
                    
                    
                    Severity: Minor
                    Found in app/controllers/review_mapping_controller.rb - About 1 day to fix

                    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

                    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
                    Severity: Major
                    Found in spec/helpers/authorization_helper_spec.rb - About 1 day to fix

                      File assignment.rb has 491 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      class Assignment < ApplicationRecord
                        require 'analytic/assignment_analytic'
                        include Scoring
                        include AssignmentAnalytic
                        include ReviewAssignment
                      Severity: Minor
                      Found in app/models/assignment.rb - About 7 hrs to fix

                        Class Assignment has 54 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class Assignment < ApplicationRecord
                          require 'analytic/assignment_analytic'
                          include Scoring
                          include AssignmentAnalytic
                          include ReviewAssignment
                        Severity: Major
                        Found in app/models/assignment.rb - About 7 hrs to fix

                          Function methods has 187 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            var methods = (function () {
                              // private properties and methods go here
                              var c = {
                                bcClass: 'sf-breadcrumb',
                                menuClass: 'sf-js-enabled',
                          Severity: Major
                          Found in app/assets/javascripts/superfish.js - About 7 hrs to fix

                            File review_mapping_controller.rb has 471 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            class ReviewMappingController < ApplicationController
                              include AuthorizationHelper
                            
                              autocomplete :user, :name
                              # helper :dynamic_review_assignment
                            Severity: Minor
                            Found in app/controllers/review_mapping_controller.rb - About 7 hrs to fix

                              Class AssignmentsController has 48 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                              class AssignmentsController < ApplicationController
                                include AssignmentHelper
                                include AuthorizationHelper
                                autocomplete :user, :name
                                before_action :authorize
                              Severity: Minor
                              Found in app/controllers/assignments_controller.rb - About 6 hrs to fix

                                File datetimepicker.js has 439 lines of code (exceeds 250 allowed). Consider refactoring.
                                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
                                Severity: Minor
                                Found in app/assets/javascripts/datetimepicker.js - About 6 hrs to fix

                                  File assignments_controller_spec.rb has 419 lines of code (exceeds 250 allowed). Consider refactoring.
                                  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
                                  Severity: Minor
                                  Found in spec/controllers/assignments_controller_spec.rb - About 6 hrs to fix

                                    File user_spec.rb has 413 lines of code (exceeds 250 allowed). Consider refactoring.
                                    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
                                    Severity: Minor
                                    Found in spec/models/user_spec.rb - About 5 hrs to fix

                                      Method import_from_hash has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                                      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 = []
                                      Severity: Minor
                                      Found in app/controllers/import_file_controller.rb - About 5 hrs to fix

                                      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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language