ece517-p3/expertiza

View on GitHub

Showing 2,813 of 2,813 total issues

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

  def edit
    assign_instance_vars
    @prev = Response.where(map_id: @map.id)
    @review_scores = @prev.to_a
    if @prev.present?

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

  def import
    errors = import_from_hash(session, params)
    err_msg = "The following errors were encountered during import.
              <br/>Other records may have been added.
              A second submission will not duplicate these records.<br/><ul>"

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. [28.18/15]
Open

  def create
    @course = Course.new
    @course.name = params[:course][:name]
    @course.institutions_id = params[:course][:institutions_id]
    @course.directory_path = params[:course][:directory_path]

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

def deploy_global_survey(start_date, end_date, survey_name)
  login_as('instructor6')
  expect(page).to have_content('Manage content')
  create_global_questionnaire survey_name
  survey = Questionnaire.where(name: survey_name)
Severity: Minor
Found in spec/features/global_survey_spec.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

Class AssignmentParticipant has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

class AssignmentParticipant < Participant
  belongs_to  :assignment, class_name: 'Assignment', foreign_key: 'parent_id'
  has_many    :review_mappings, class_name: 'ReviewResponseMap', foreign_key: 'reviewee_id'
  has_many    :response_maps, foreign_key: 'reviewee_id'
  has_many    :quiz_mappings, class_name: 'QuizResponseMap', foreign_key: 'reviewee_id'
Severity: Minor
Found in app/models/assignment_participant.rb - About 3 hrs to fix

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

      describe '#update_quiz' do
        context 'when @questionnaire is nil' do
          it 'redirects to submitted_content#view page' do
            allow(Questionnaire).to receive(:find).with('1').and_return(nil)
            params = {id: 1, pid: 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.

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

        render: function () {
          var creation_date;
          var updated_date;
          var colWidthArray = ["30%", "0%", "0%", "0%", "25%", "25%", "20%"]
          var colDisplayStyle = {
    Severity: Major
    Found in app/assets/javascripts/tree_display.jsx - About 3 hrs to fix

      Method view_completed_question has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        def view_completed_question(count, answer, questionnaire_max, tag_prompt_deployments = nil, current_user = nil)
          html = '<b>' + count.to_s + ". " + self.txt + ' [Max points: ' + questionnaire_max.to_s + "]</b>"
      
          score = answer && !answer.answer.nil? ? answer.answer.to_s : "-"
          score_percent = if score != "-"
      Severity: Minor
      Found in app/models/criterion.rb - About 3 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 send_post_request has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        def send_post_request
          # https://www.socialtext.net/open/very_simple_rest_in_ruby_part_3_post_to_create_a_new_workspace
          req = Net::HTTP::Post.new('/reputation/calculations/reputation_algorithms', initheader = {'Content-Type' => 'application/json', 'charset' => 'utf-8'})
          curr_assignment_id = (params[:assignment_id].empty? ? '724' : params[:assignment_id])
          req.body = json_generator(curr_assignment_id, params[:another_assignment_id].to_i, params[:round_num].to_i, 'peer review grades').to_json
      Severity: Minor
      Found in app/controllers/reputation_web_service_controller.rb - About 3 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 pending_surveys has a Cognitive Complexity of 22 (exceeds 5 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 3 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 initialize is too high. [27/15]
      Open

        def initialize(role = nil)
          @root = Node.new
          @by_id = {}
          @by_name = {}
          @selected = {}
      Severity: Minor
      Found in app/models/menu.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 scores_varying_rubrics is too high. [27.29/15]
      Open

      def scores_varying_rubrics
        rounds = self.rounds_of_reviews
        (1..rounds).each do |round|
          review_questionnaire_id = review_questionnaire_id(round)
          @questions = Question.where('questionnaire_id = ?', review_questionnaire_id)
      Severity: Minor
      Found in app/models/on_the_fly_calc.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 complete is too high. [27.28/15]
      Open

        def complete
          quiz_question_choices = QuizQuestionChoice.where(question_id: self.id)
          html = "<label for=\"" + self.id.to_s + "\">" + self.txt + "</label><br>"
          for i in 0..1
            txt = quiz_question_choices[i].txt
      Severity: Minor
      Found in app/models/true_false.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 construct_review_response is too high. [27.46/15]
      Open

        def construct_review_response code, self_id, show_tags = nil, current_user = nil
          code += '<table id="review_' + self_id + '" style="display: none;" class="table table-bordered">'
          answers = Answer.where(response_id: self.response_id)
          unless answers.empty?
            questionnaire = self.questionnaire_by_answer(answers.first)
      Severity: Minor
      Found in app/models/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

      Cyclomatic complexity for get_questions_from_csv is too high. [18/6]
      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 by rubocop

      This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

      An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

      Cyclomatic complexity for peer_review_strategy is too high. [18/6]
      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 cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

      An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

      Assignment Branch Condition size for start_self_review is too high. [27.37/15]
      Open

        def start_self_review
          user_id = params[:reviewer_userid]
          assignment = Assignment.find(params[:assignment_id])
          team = Team.find_team_for_assignment_and_user(assignment.id, user_id).first
          begin

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

        def edit_advice
          @questionnaire = Questionnaire.find(params[:id])
      
          @questionnaire.questions.each do |question|
            num_questions = if question.is_a?(ScoredQuestion)

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

        def delete
          @questionnaire = Questionnaire.find(params[:id])
          if @questionnaire
            begin
              name = @questionnaire.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 delete_selected_files is too high. [27.29/15]
      Open

        def delete_selected_files
          filename = params[:directories][params[:chk_files]] + "/" + params[:filenames][params[:chk_files]]
          FileUtils.rm_r(filename)
          participant = Participant.find_by(id: params[:id])
          assignment = participant.try(:assignment)

      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