ece517-p3/expertiza

View on GitHub

Showing 2,813 of 2,813 total issues

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

describe GradesController do
  let(:review_response) { build(:response) }
  let(:assignment) { build(:assignment, id: 1, questionnaires: [review_questionnaire], is_penalty_calculated: true) }
  let(:assignment_questionnaire) { build(:assignment_questionnaire, used_in_round: 1, assignment: assignment) }
  let(:participant) { build(:participant, id: 1, assignment: assignment, user_id: 1) }

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.

Assignment Branch Condition size for list is too high. [110.1/15]
Open

  def list
    @automated_metareview = AutomatedMetareview.new
    # pass in the response id as a parameter
    @response = Response.find_by(map_id: params[:id])
    @automated_metareview.calculate_metareview_metrics(@response, params[:id])

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. [173/25]
Open

  describe "topic_suggestion" do
    it "Instructor set an assignment which allow student suggest topic and register student2065" do
      # login as student2065, Note by Xing Pan: modify spec/factories/factories.rb to generate student11 and call "create student" at beginning
      user = User.find_by(name: 'student2064')
      stub_current_user(user, user.role.name, user.role)

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.

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

describe Response do
  let(:participant) { build(:participant, id: 1, user: build(:student, name: 'no name', fullname: 'no one')) }
  let(:participant2) { build(:participant, id: 2) }
  let(:assignment) { build(:assignment, id: 1, name: 'Test Assgt') }
  let(:team) { build(:assignment_team) }
Severity: Minor
Found in spec/models/response_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.

Assignment Branch Condition size for save_choices is too high. [107.1/15]
Open

  def save_choices(questionnaire_id)
    return unless params[:new_question] or params[:new_choices]
    questions = Question.where(questionnaire_id: questionnaire_id)
    question_num = 1

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 impersonate is too high. [102.4/15]
Open

  def impersonate
    if params[:user]
      message = "No user exists with the name '#{params[:user][:name]}'."
    elsif params[:impersonate]
      message = "No user exists with the name '#{params[:impersonate][:name]}'."

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 peer_review_strategy is too high. [98.49/15]
Open

  def peer_review_strategy(assignment_id, review_strategy, participants_hash)
    teams = review_strategy.teams
    participants = review_strategy.participants
    num_participants = participants.size

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. [156/25]
Open

describe ReportsController do
  let(:assignment) { double('Assignment', id: 1) }
  let(:review_response_map) do
    double('ReviewResponseMap', id: 1, map_id: 1, assignment: assignment,
                                reviewer: double('Participant', id: 1, name: 'reviewer'), reviewee: double('Participant', id: 2, name: 'reviewee'))

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.

File assignment_creation_spec.rb has 625 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

    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

    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.

    File questionnaires_controller_spec.rb has 577 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

      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.

      Assignment Branch Condition size for hash_rows_with_headers is too high. [84.84/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 }
            header.map!(&:to_sym)

      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. [123/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.

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

      describe Menu do
        # To test menu, a variety of menu_items must exist.
        # role_admin.yml defines the permissionIds for admin as 5,5,6,3,2
        # we must assign controlleractions and contentpages
        # with permissionIds of those numbers
      Severity: Minor
      Found in spec/models/menu_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 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

      Severity
      Category
      Status
      Source
      Language