expertiza/expertiza

View on GitHub

Showing 431 of 4,497 total issues

File questionnaires_controller_spec.rb has 403 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: Minor
Found in spec/controllers/questionnaires_controller_spec.rb - About 5 hrs to fix

    File sign_up_sheet_controller.rb has 395 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class SignUpSheetController < ApplicationController
      include AuthorizationHelper
    
      require 'rgl/adjacency'
      require 'rgl/dot'
    Severity: Minor
    Found in app/controllers/sign_up_sheet_controller.rb - About 5 hrs to fix

      File assignments_controller.rb has 393 lines of code (exceeds 250 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 5 hrs to fix

        File response_controller_spec.rb has 393 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        describe ResponseController do
          let(:assignment) { build(:assignment, instructor_id: 6, id: 1) }
          let(:instructor) { build(:instructor, id: 6) }
          let(:participant) { build(:participant, id: 1, user_id: 6, assignment: assignment) }
          let(:review_response) { build(:response, id: 1, map_id: 1) }
        Severity: Minor
        Found in spec/controllers/response_controller_spec.rb - About 5 hrs to fix

          Method assign_reviewer_dynamically has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

            def assign_reviewer_dynamically
              assignment = Assignment.find(params[:assignment_id])
              participant = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id: assignment.id).first
              reviewer = participant.get_reviewer
              if params[:i_dont_care].nil? && params[:topic_id].nil? && assignment.topics? && assignment.can_choose_topic_to_review?
          Severity: Minor
          Found in app/controllers/review_mapping_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

          Method calculate_score has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

            def calculate_score(map, response)
              questionnaire = Questionnaire.find(map.reviewed_object_id)
              scores = []
              valid = true
              questions = Question.where(questionnaire_id: questionnaire.id)
          Severity: Minor
          Found in app/controllers/student_quizzes_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

          File assignment_form.rb has 373 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'active_support/time_with_zone'
          
          class AssignmentForm
            attr_accessor :assignment,
                          :assignment_questionnaires,
          Severity: Minor
          Found in app/models/assignment_form.rb - About 4 hrs to fix

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

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

              Class AssignmentTeam has 36 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class AssignmentTeam < Team
                require File.dirname(__FILE__) + '/analytic/assignment_team_analytic'
                include AssignmentTeamAnalytic
                include Scoring
              
              
              Severity: Minor
              Found in app/models/assignment_team.rb - About 4 hrs to fix

                File assessment360_controller_spec.rb has 361 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                describe Assessment360Controller do
                  let(:instructor) { build(:instructor, id: 6) }
                  let(:student) { build(:student, id: 6) }
                  let(:ta) { build(:teaching_assistant, id: 6) }
                  let(:administrator) { build(:admin, id: 6) }
                Severity: Minor
                Found in spec/controllers/assessment360_controller_spec.rb - About 4 hrs to fix

                  File quiz_spec.rb has 359 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  include InstructorInterfaceHelperSpec
                  
                  def create_assignment_due_date
                    set_deadline_type
                    set_deadline_right
                  Severity: Minor
                  Found in spec/features/quiz_spec.rb - About 4 hrs to fix

                    File users_controller_spec.rb has 357 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    describe UsersController do
                      let(:admin) { build(:admin, id: 3) }
                      let(:super_admin) { build(:superadmin) }
                      let(:instructor) { build(:instructor, id: 2) }
                      let(:student1) { build(:student, id: 1, name: :lily) }
                    Severity: Minor
                    Found in spec/controllers/users_controller_spec.rb - About 4 hrs to fix

                      Function RenderCal has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function RenderCal()
                      {
                          var vCalHeader;
                          var vCalData;
                          var vCalTime;
                      Severity: Minor
                      Found in app/assets/javascripts/datetimepicker.js - About 4 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

                      Method four_node_cycles has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def four_node_cycles(assignment_participant)
                          collusion_cycles = []
                          assignment_participant.reviewers.each do |ap1|
                            ap1.reviewers.each do |ap2|
                              ap2.reviewers.each do |ap3|
                      Severity: Minor
                      Found in app/models/collusion_cycle.rb - About 4 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

                      Method create has a Cognitive Complexity of 30 (exceeds 5 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."
                      Severity: Minor
                      Found in app/controllers/teams_users_controller.rb - About 4 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

                      Function render has 109 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 4 hrs to fix

                        File review_mapping_helper.rb has 348 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        module ReviewMappingHelper
                          def create_report_table_header(headers = {})
                            render partial: 'report_table_header', locals: { headers: headers }
                          end
                        
                        
                        Severity: Minor
                        Found in app/helpers/review_mapping_helper.rb - About 4 hrs to fix

                          Method import_from_hash has 108 lines of code (exceeds 25 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: Major
                          Found in app/controllers/import_file_controller.rb - About 4 hrs to fix

                            Method update_tag_prompt_deployments has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def update_tag_prompt_deployments(attributes)
                                unless attributes.nil?
                                  attributes.each do |key, value|
                                    if @assignment.vary_by_topic?
                                      @assignment.questionnaires.uniq.each do |questionnaire|
                            Severity: Minor
                            Found in app/models/assignment_form.rb - About 4 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 assignment_team_spec.rb has 343 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            describe 'AssignmentTeam' do
                              let(:team_without_submitted_hyperlinks) { build(:assignment_team, submitted_hyperlinks: '') }
                              let(:team) { build(:assignment_team, id: 1, parent_id: 1) }
                              let(:assignment) { build(:assignment, id: 1) }
                              let(:participant1) { build(:participant, id: 1) }
                            Severity: Minor
                            Found in spec/models/assignment_team_spec.rb - About 4 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language