ece517-p3/expertiza

View on GitHub

Showing 2,813 of 2,813 total issues

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

    context 'when user can be found' do
      before(:each) do
        allow(User).to receive(:find_by).with(name: 'no name').and_return(student)
      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.

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

  context "#create_requested_user_record" do
    it 'if user not exists and requested user is saved' do
      params = {
        user: {name: 'instructor6',
               role_id: 2,

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

  describe '#redirect' do
    before(:each) do
      allow(Response).to receive(:find_by).with(map_id: '1').and_return(review_response)
      @params = {id: 1}
    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.

Method send_post_request has 66 lines of code (exceeds 25 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: Major
Found in app/controllers/reputation_web_service_controller.rb - About 2 hrs to fix

    Function componentWillMount has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        componentWillMount: function() {
          var _this = this
          preloadImages('/assets/tree_view/edit-icon-24.png',
                        '/assets/tree_view/delete-icon-24.png',
                        '/assets/tree_view/lock-off-disabled-icon-24.png',
    Severity: Major
    Found in app/assets/javascripts/tree_display.jsx - About 2 hrs to fix

      Function dateFormat has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var dateFormat = function () {
        var    token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
            timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
            timezoneClip = /[^-+\dA-Z]/g,
            pad = function (val, len) {
      Severity: Major
      Found in app/assets/javascripts/application.js - About 2 hrs to fix

        Perceived complexity for get is too high. [15/7]
        Open

          def self.get(sortvar = nil, sortorder = nil, user_id = nil, show = nil, parent_id = nil, _search = nil)
            conditions = if show
                           if User.find(user_id).role.name != "Teaching Assistant"
                             'questionnaires.instructor_id = ?'
                           else
        Severity: Minor
        Found in app/models/questionnaire_node.rb by rubocop

        This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

        Example:

        def my_method                   # 1
          if cond                       # 1
            case var                    # 2 (0.8 + 4 * 0.2, rounded)
            when 1 then func_one
            when 2 then func_two
            when 3 then func_three
            when 4..10 then func_other
            end
          else                          # 1
            do_something until a && b   # 2
          end                           # ===
        end                             # 7 complexity points

        Assignment Branch Condition size for setup is too high. [23.49/15]
        Open

            def setup(item)
              @parent_id = item.parent_id
              @name = item.name
              @id = item.id
              @label = item.label
        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 compute_scores is too high. [23.73/15]
        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 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 export_data_fields is too high. [23.11/15]
        Open

          def self.export_data_fields(options)
            if options['team_score'] == 'true'
              team[:scores] ?
                tcsv.push(team[:scores][:max], team[:scores][:min], team[:scores][:avg]) :
                tcsv.push('---', '---', '---')
        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

        Cyclomatic complexity for view_completed_question is too high. [14/6]
        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 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.

        Assignment Branch Condition size for get_intelligent_topic_row is too high. [23.73/15]
        Open

          def get_intelligent_topic_row(topic, selected_topics, max_team_size = 3)
            row_html = ''
            if selected_topics.present?
              selected_topics.each do |selected_topic|
                row_html = if selected_topic.topic_id == topic.id and !selected_topic.is_waitlisted
        Severity: Minor
        Found in app/helpers/sign_up_sheet_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 render_participant_info is too high. [23.96/15]
        Open

          def render_participant_info(topic, assignment, participants)
            html = ''
            if participants.present?
              chooser_present = false
              participants.each do |participant|
        Severity: Minor
        Found in app/helpers/sign_up_sheet_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 adjust_advice_size is too high. [23.15/15]
        Open

          def self.adjust_advice_size(questionnaire, question)
            # now we only support question advices for scored questions
            if question.is_a?(ScoredQuestion)
        
              max = questionnaire.max_question_score
        Severity: Minor
        Found in app/helpers/questionnaire_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 get_team_name_color_in_review_report is too high. [23.62/15]
        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?

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

          def create
            @suggestion = Suggestion.new(suggestion_params)
            @suggestion.assignment_id = session[:assignment_id]
            @assignment = Assignment.find(session[:assignment_id])
            @suggestion.status = 'Initiated'

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

          def add_comment
            @suggestioncomment = SuggestionComment.new(vote: params[:suggestion_comment][:vote], comments: params[:suggestion_comment][:comments])
            @suggestioncomment.suggestion_id = params[:id]
            @suggestioncomment.commenter = session[:user].name
            if @suggestioncomment.save

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

          def calibration(params, session)
            assign_basics(params)
            user = session[:user]
            participant = AssignmentParticipant.where(parent_id: @id, user_id: user.id).first rescue nil
            create_participant(@id, user.id) if participant.nil?

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

          def bequeath
            team = AssignmentTeam.find(params[:id])
            assignment = Assignment.find(team.parent_id)
            if assignment.course_id >= 0
              course = Course.find(assignment.course_id)
        Severity: Minor
        Found in app/controllers/teams_controller.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 index is too high. [23/15]
        Open

          def index
            @tag_prompts = []
        
            tag_deployments = TagPromptDeployment.all
            tag_deployments = tag_deployments.where(assignment_id: params[:assignment_id]) if params.key?(:assignment_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

        Severity
        Category
        Status
        Source
        Language