ece517-p3/expertiza

View on GitHub

Showing 2,813 of 2,813 total issues

Method compute_scores has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.compute_scores(assessments, questions)
    scores = {}
    if assessments.present?
      scores[:max] = -999_999_999
      scores[:min] = 999_999_999
Severity: Minor
Found in app/models/answer.rb - About 1 hr to fix

    Method get_team_name_color_in_review_report has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def get_team_name_color_in_review_report(response_map)
        assignment_created = @assignment.created_at
        assignment_due_dates = DueDate.where(parent_id: response_map.reviewed_object_id)
        if Response.exists?(map_id: response_map.id)
          if !response_map.try(:reviewer).try(:review_grade).nil?
    Severity: Minor
    Found in app/helpers/review_mapping_helper.rb - About 1 hr to fix

      Method assign_reviewer_dynamically has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def assign_reviewer_dynamically
          assignment = Assignment.find(params[:assignment_id])
          reviewer = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id: assignment.id).first
      
          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 1 hr to fix

        Method summarize_reviews_by_criterion has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def summarize_reviews_by_criterion(assignment, summary_ws_url)
              # @summary[reviewee][round][question]
              # @avg_score_round[reviewee][round]
              # @avg_scores_by_criterion[reviewee][round][criterion]
              nround = assignment.rounds_of_reviews
        Severity: Minor
        Found in app/helpers/summary_helper.rb - About 1 hr to fix

          Method update has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def update
              @penalty_policy = LatePolicy.find(params[:id])
              invalid_penalty_per_unit = params[:late_policy][:max_penalty].to_i < params[:late_policy][:penalty_per_unit].to_i
              flash[:error] = "The maximum penalty cannot be less than penalty per unit." if invalid_penalty_per_unit
              same_policy_name = false
          Severity: Minor
          Found in app/controllers/late_policies_controller.rb - About 1 hr to fix

            Method db_query has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def db_query(assignment_id, round_num, has_topic, another_assignment_id = 0)
                raw_data_array = []
                assignment_ids = []
                assignment_ids << assignment_id
                assignment_ids << another_assignment_id unless another_assignment_id.zero?
            Severity: Minor
            Found in app/controllers/reputation_web_service_controller.rb - About 1 hr to fix

              Method pending_surveys has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def pending_surveys
                  unless session[:user] # Check for a valid user
                    redirect_to '/'
                    return
                  end
              Severity: Minor
              Found in app/controllers/response_controller.rb - About 1 hr to fix

                Method copy_questionnaire_details has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def copy_questionnaire_details(questions, orig_questionnaire)
                    @questionnaire.instructor_id = assign_instructor_id
                    @questionnaire.name = 'Copy of ' + orig_questionnaire.name
                    begin
                      @questionnaire.created_at = Time.now
                Severity: Minor
                Found in app/controllers/questionnaires_controller.rb - About 1 hr to fix

                  Function collapseObj has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function collapseObj(obj, atag){
                      obj.style.display = 'none';
                        atag.innerHTML = '<img src="/assets/expand.png">';              
                               
                        files = document.getElementById(obj.id+'_files');
                  Severity: Minor
                  Found in app/assets/javascripts/grading.js - About 1 hr to fix

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

                        render: function() {
                          return (
                            <div className="filterable_table">
                              <SearchBar
                                filterText={this.state.filterText}
                    Severity: Minor
                    Found in app/assets/javascripts/tree_display.jsx - About 1 hr to fix

                      Method delete has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def delete(force = nil)
                          begin
                            maps = ReviewResponseMap.where(reviewed_object_id: self.id)
                            maps.each {|map| map.delete(force) }
                          rescue StandardError
                      Severity: Minor
                      Found in app/models/assignment.rb - About 1 hr to fix

                        Method compute_penalty_on_reviews has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def compute_penalty_on_reviews(review_mappings, review_due_date, num_of_reviews_required)
                            review_map_created_at_list = []
                            penalty = 0
                            # Calculate the number of reviews that the user has completed so far.
                            review_mappings.each do |map|
                        Severity: Minor
                        Found in app/helpers/penalty_helper.rb - About 1 hr to fix

                          Method run_intelligent_assignment has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def run_intelligent_assignment
                              priority_info = []
                              assignment = Assignment.find_by(id: params[:id])
                              topics = assignment.sign_up_topics
                              teams = assignment.teams
                          Severity: Minor
                          Found in app/controllers/lottery_controller.rb - About 1 hr to fix

                            Method initialize_chart_elements has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def initialize_chart_elements(reviewer)
                                round = 0
                                labels = []
                                reviewer_data = []
                                all_reviewers_data = []
                            Severity: Minor
                            Found in app/helpers/review_mapping_helper.rb - About 1 hr to fix

                              Method set_priority has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def set_priority
                                  participant = AssignmentParticipant.find_by(id: params[:participant_id])
                                  assignment_id = SignUpTopic.find(params[:topic].first).assignment.id
                                  team_id = participant.team.try(:id)
                                  unless team_id
                              Severity: Minor
                              Found in app/controllers/sign_up_sheet_controller.rb - About 1 hr to fix

                                Consider simplifying this complex logical expression.
                                Open

                                    raise ArgumentError, "Not enough fields on this line." if row_hash.empty? || (row_hash[:teammembers].length < 2 && (options[:has_teamname] == "true_first" || options[:has_teamname] == "true_last")) || (row_hash[:teammembers].empty? && (options[:has_teamname] == "true_first" || options[:has_teamname] == "true_last"))
                                Severity: Major
                                Found in app/models/team.rb - About 1 hr to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                                  if (selectedtabfromurl==i || this.enabletabpersistence && selectedtab==-1 && parseInt(persistedtab)==i || !this.enabletabpersistence && selectedtab==-1 && this.getselectedClassTarget(this.tabs[i]).className=="selected"){
                                                      selectedtab=i //Selected tab index, if found
                                                  }
                                  Severity: Major
                                  Found in app/assets/javascripts/ajaxtabs.js - About 1 hr to fix

                                    Consider simplifying this complex logical expression.
                                    Open

                                                          if (((entry.name && entry.name.indexOf(_this.props.filterText) !== -1) ||
                                                              (entry.creation_date && entry.creation_date.indexOf(_this.props.filterText) !== -1) ||
                                                              (entry.updated_date && entry.updated_date.indexOf(_this.props.filterText) !== -1)) &&
                                                              (entry.private == false)) {
                                                              _rows.push(<ContentTableRow
                                    Severity: Major
                                    Found in app/assets/javascripts/tree_display.jsx - About 1 hr to fix

                                      Consider simplifying this complex logical expression.
                                      Open

                                          if map.is_a? ReviewResponseMap
                                            reviewee_team = AssignmentTeam.find(map.reviewee_id)
                                            return current_user_id?(user_id) || reviewee_team.user?(current_user) || current_user.role.name == 'Administrator' ||
                                              (current_user.role.name == 'Instructor' and assignment.instructor_id == current_user.id) ||
                                              (current_user.role.name == 'Teaching Assistant' and TaMapping.exists?(ta_id: current_user.id, course_id: assignment.course.id))
                                      Severity: Major
                                      Found in app/controllers/response_controller.rb - About 1 hr to fix

                                        Block has too many lines. [33/25]
                                        Open

                                          describe '#update_due_dates' do
                                            context 'when attributes are nil' do
                                              it 'returns false' do
                                                expect(assignment_form.update_due_dates(nil, user)).to be false
                                              end
                                        Severity: Minor
                                        Found in spec/models/assignment_form_spec.rb by rubocop

                                        This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language