expertiza/expertiza

View on GitHub

Showing 429 of 2,864 total issues

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

jQuery(document).ready(function() {
  // This preloadedImages function is refered from http://jsfiddle.net/slashingweapon/8jAeu/
  // Actually I am not using the values in preloadedImages, but image loading speed is indeed getting faster
  var preloadedImages = []
  function preloadImages() {
Severity: Major
Found in app/assets/javascripts/tree_display.jsx - About 2 days to fix

    File assignment_creation_spec.rb has 633 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    def questionnaire_options(assignment, type, _round = 0)
      questionnaires = Questionnaire.where(['private = 0 or instructor_id = ?', assignment.instructor_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 questionnaires_controller_spec.rb has 592 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      describe QuestionnairesController do
        let(:questionnaire) do
          build(id: 1, name: 'questionnaire', ta_id: 8, course_id: 1, private: false, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire')
        end
        let(:questionnaire) { build(:questionnaire) }
      Severity: Major
      Found in spec/controllers/questionnaires_controller_spec.rb - About 1 day to fix

        Method get_questions_from_csv has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.get_questions_from_csv(questionnaire, file)
            questions = []
            custom_rubric = questionnaire.section == "Custom"
        
            CSV::Reader.parse(file) do |row|
        Severity: Minor
        Found in app/helpers/questionnaire_helper.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

        Method peer_review_strategy has a Cognitive Complexity of 58 (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

        Function render has 223 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 review_mapping_controller_spec.rb has 526 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'rails_helper'
          describe ReviewMappingController do
            let(:assignment) { double('Assignment', id: 1) }
            let(:review_response_map) do
              double('ReviewResponseMap', id: 1, map_id: 1, assignment: assignment,
          Severity: Major
          Found in spec/controllers/review_mapping_controller_spec.rb - About 1 day to fix

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

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

              File assignment_spec.rb has 490 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]) }
                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: Minor
              Found in spec/models/assignment_spec.rb - About 7 hrs to fix

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

                    render: function() {
                      var moreContent = []
                      var buttonContent = ""
                      var moreButtonStyle = {
                        "display": "",
                Severity: Major
                Found in app/assets/javascripts/tree_display.jsx - 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 questionnaires_controller.rb has 468 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    class QuestionnairesController < ApplicationController
                      # Controller for Questionnaire objects
                      # A Questionnaire can be of several types (QuestionnaireType)
                      # Each Questionnaire contains zero or more questions (Question)
                      # Generally a questionnaire is associated with an assignment (Assignment)
                    Severity: Minor
                    Found in app/controllers/questionnaires_controller.rb - About 7 hrs to fix

                      Method complete has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def complete(count, answer = nil, questionnaire_min, questionnaire_max, dropdown_or_scale)
                          if self.size.nil?
                            cols = '70'
                            rows = '1'
                          else
                      Severity: Minor
                      Found in app/models/criterion.rb - About 7 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

                      File sign_up_sheet_controller_spec.rb has 441 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) }
                        let(:instructor) { build(:instructor, id: 6) }
                        let(:student) { build(:student, id: 8) }
                        let(:participant) { build(:participant, id: 1, user_id: 6, assignment: assignment) }
                      Severity: Minor
                      Found in spec/controllers/sign_up_sheet_controller_spec.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

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

                          class Assignment < ActiveRecord::Base
                            require 'analytic/assignment_analytic'
                            include AssignmentAnalytic
                            include ReviewAssignment
                            include QuizAssignment
                          Severity: Minor
                          Found in app/models/assignment.rb - About 6 hrs to fix

                            Method update_quiz has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def update_quiz
                                @questionnaire = Questionnaire.find(params[:id])
                                if @questionnaire.nil?
                                  redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]
                                  return
                            Severity: Minor
                            Found in app/controllers/questionnaires_controller.rb - About 6 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

                            Class TreeDisplayController has 45 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                            class TreeDisplayController < ApplicationController
                              helper :application
                              include SecurityHelper
                            
                              def action_allowed?
                            Severity: Minor
                            Found in app/controllers/tree_display_controller.rb - About 6 hrs to fix

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

                              class ReviewMappingController < ApplicationController
                                autocomplete :user, :name
                                # use_google_charts
                                require 'gchart'
                                # helper :dynamic_review_assignment
                              Severity: Minor
                              Found in app/controllers/review_mapping_controller.rb - About 6 hrs to fix

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

                                FactoryBot.define do
                                  factory :institution, class: Institution do
                                    name 'North Carolina State University'
                                  end
                                
                                
                                Severity: Minor
                                Found in spec/factories/factories.rb - About 5 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language