ece517-p3/expertiza

View on GitHub

Showing 2,813 of 2,813 total issues

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

    Assignment Branch Condition size for csv_row is too high. [56.05/15]
    Open

      def self.csv_row(detail_options, answer)
        tcsv = []
        @response = Response.find(answer.response_id)
        map = ResponseMap.find(@response.map_id)
        @reviewee = Team.find_by id: map.reviewee_id
    Severity: Minor
    Found in app/models/assignment.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 course_options is too high. [56.58/15]
    Open

      def course_options(instructor)
        if session[:user].role.name == 'Teaching Assistant'
          courses = []
          ta = Ta.find(session[:user].id)
          ta.ta_mappings.each {|mapping| courses << Course.find(mapping.course_id) }
    Severity: Minor
    Found in app/helpers/assignment_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 create is too high. [56.37/15]
    Open

      def create
        @assignment_form = AssignmentForm.new(assignment_form_params)
        if params[:button]
          if @assignment_form.save
            @assignment_form.create_assignment_node

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

      describe '#automatic_review_mapping' do
        before(:each) do
          allow(AssignmentParticipant).to receive(:where).with(parent_id: 1).and_return([participant, participant1, participant2])
        end
    
    

    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 sign_up_sheet_controller_spec.rb has 432 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

      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

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

        describe Node do
          let(:node) { Menu::Node.new }
          let(:content_page) { double('ContentPage', id: 1, name: 'name') }
          let(:controller_action) { double('ControllerAction', id: 99, name: 'name', url_to_use: 'url', controller: nil) }
          let(:controller) { double('Controller', id: 3, name: 'name') }
        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 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

        Assignment Branch Condition size for valid_quiz is too high. [54.09/15]
        Open

          def valid_quiz
            num_quiz_questions = Assignment.find(params[:aid]).num_quiz_questions
            valid = "valid"
        
            (1..num_quiz_questions).each do |i|

        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 create is too high. [54.74/15]
        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."

        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

        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

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

          describe "Airbrake expection errors" do
            before(:each) do
              create(:assignment, name: "TestAssignment", directory_path: 'test_assignment')
              create_list(:participant, 3)
              create(:assignment_node)

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

            def slider_control(answer, tag_prompt_deployment, stored_tags)
              html = ""
              value = "0"
              if stored_tags.count > 0
                tag = stored_tags.first
          Severity: Minor
          Found in app/models/tag_prompt.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 edit is too high. [53.16/15]
          Open

            def edit(_count)
              html = '<tr>'
              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]" id="question_' + self.id.to_s + '_seq" type="text"></td>'
              html += '<td><textarea cols="50" rows="1" name="question[' + self.id.to_s + '][txt]" id="question_' + self.id.to_s + '_txt" placeholder="Edit question content here">' + self.txt + '</textarea></td>'
          Severity: Minor
          Found in app/models/text_response.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 edit is too high. [53.49/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
              html += '" name="question[' + self.id.to_s + '][seq]" id="question_' + self.id.to_s + '_seq" type="text"></td>'
          Severity: Minor
          Found in app/models/dropdown.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

          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

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

              describe '#four_node_cycles' do
                context 'when the reviewers of current reviewer (ap3) does not include current assignment participant' do
                  it 'skips this reviewer (ap3) and returns corresponding collusion cycles' do
                    # Sets up stubs for test
                    allow(ReviewResponseMap).to receive(:where).with('reviewee_id = ?', team1.id).and_return([response_map_team_1_2])
            Severity: Minor
            Found in spec/models/collusion_cycle_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 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

              Assignment Branch Condition size for assignment_tagging_progress is too high. [51.05/15]
              Open

                def assignment_tagging_progress
                  teams = Team.where(parent_id: self.assignment_id)
                  questions = Question.where(questionnaire_id: self.questionnaire.id, type: self.question_type)
                  questions_ids = questions.map(&:id)
                  user_answer_tagging = []
              Severity: Minor
              Found in app/models/tag_prompt_deployment.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

              Severity
              Category
              Status
              Source
              Language