expertiza/expertiza

View on GitHub

Showing 2,739 of 2,748 total issues

Assignment Branch Condition size for hash_rows_with_headers is too high. [91.55/15]
Open

  def hash_rows_with_headers(header, body)
    new_body = []
    if params[:model] == "User" or params[:model] == "AssignmentParticipant" or params[:model] == "CourseParticipant" or params[:model] == "SignUpTopic"
      header.map! { |column_name| column_name.to_sym }
      body.each do |row|

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for edit is too high. [90.14/15]
Open

  def edit(_count)
    html = '<td align="center"><a rel="nofollow" data-method="delete" href="/questions/' + self.id.to_s + '">Remove</a></td>'

    html += '<td><input size="6" value="' + self.seq.to_s + '" name="question[' + self.id.to_s + '][seq]"'
    html += ' id="question_' + self.id.to_s + '_seq" type="text"></td>'
Severity: Minor
Found in app/models/criterion.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for summarize_reviews_by_reviewees is too high. [89.93/15]
Open

    def summarize_reviews_by_reviewees(assignment, summary_ws_url)
      # @summary[reviewee][round][question]
      # @reviewers[team][reviewer]
      # @avg_scores_by_reviewee[team]
      # @avg_score_round[reviewee][round]
Severity: Minor
Found in app/helpers/summary_helper.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Module has too many lines. [133/100]
Open

module AssignmentHelper
  def course_options(instructor)
    if session[:user].role.name == 'Teaching Assistant'
      courses = []
      ta = Ta.find(session[:user].id)
Severity: Minor
Found in app/helpers/assignment_helper.rb by rubocop

This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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

    Assignment Branch Condition size for merge_scores is too high. [87.87/15]
    Open

      def merge_scores(scores)
        review_sym = "review".to_sym
        scores[review_sym] = {}
        scores[review_sym][:assessments] = []
        scores[review_sym][:scores] = {max: -999_999_999, min: 999_999_999, avg: 0}

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

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

    describe MenuItem do
      ###
      # Use factories to `build` necessary objects.
      # Please avoid duplicated code as much as you can by moving the code to `before(:each)` block or separated methods.
      # RSpec tutorial video (until 9:32): https://youtu.be/dzkVfaKChSU?t=35s
    Severity: Minor
    Found in spec/models/menu_item_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.

    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

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

      describe "POST #children_node_ng for TA" do
        before(:each) do
          @treefolder = TreeFolder.new
          @treefolder.parent_id = nil
          @treefolder.name = "Courses"

    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.

    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

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

    describe Answer do
      let(:questionnaire) { create(:questionnaire, id: 1) }
      let(:question1) { create(:question, questionnaire: questionnaire, weight: 1, id: 1) }
      let(:question2) { create(:question, questionnaire: questionnaire, weight: 2, id: 2) }
      let(:response_map) { create(:review_response_map, id: 1, reviewed_object_id: 1) }
    Severity: Minor
    Found in spec/models/answer_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.

    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

      Assignment Branch Condition size for complete is too high. [77.84/15]
      Open

        def complete(count, questionnaire_min, questionnaire_max, answer = nil)
          html = '<div><label for="responses_' + count.to_s + '">' + self.txt + '</label></div>'
          html += '<input id="responses_' + count.to_s + '_score" name="responses[' + count.to_s + '][score]" type="hidden"'
          html += 'value="' + answer.answer.to_s + '"' unless answer.nil?
          html += '>'
      Severity: Minor
      Found in app/models/scale.rb by rubocop

      This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

      Assignment Branch Condition size for all_students_all_reviews is too high. [77.85/15]
      Open

        def all_students_all_reviews
          course = Course.find(params[:course_id])
          @assignments = course.assignments.reject(&:is_calibrated).reject {|a| a.participants.empty? }
          @course_participants = course.get_participants
          if @course_participants.empty?

      This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

      Module has too many lines. [109/100]
      Open

      module ReviewAssignment
        def contributors
          # ACS Contributors are just teams, so removed check to see if it is a team assignment
          @contributors ||= teams # ACS
        end
      Severity: Minor
      Found in app/models/review_assignment.rb by rubocop

      This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

      Assignment Branch Condition size for edit is too high. [76.16/15]
      Open

        def edit
          quiz_question_choices = QuizQuestionChoice.where(question_id: self.id)
      
          html = '<tr><td>'
          html += '<textarea cols="100" name="question[' + self.id.to_s + '][txt]" '

      This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

      File review_mapping_controller_spec.rb has 532 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

        Module has too many lines. [105/100]
        Open

        module GradesHelper
          # Render the title
          def get_accordion_title(last_topic, new_topic)
            if last_topic.eql? nil
              # this is the first accordion
        Severity: Minor
        Found in app/helpers/grades_helper.rb by rubocop

        This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

        Module has too many lines. [104/100]
        Open

        module PenaltyHelper
          def calculate_penalty(participant_id)
            @submission_deadline_type_id = 1
            @review_deadline_type_id = 2
            @meta_review_deadline_type_id = 5
        Severity: Minor
        Found in app/helpers/penalty_helper.rb by rubocop

        This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

        Module has too many lines. [104/100]
        Open

        module SubmittedContentHelper
          def display_directory_tree(participant, files, display_to_reviewer_flag)
            index = 0
            participant = @participant if @participant # TODO: Verify why this is needed
            assignment = participant.assignment # participant is @map.contributor

        This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

        Severity
        Category
        Status
        Source
        Language