ece517-p3/expertiza

View on GitHub

Showing 2,813 of 2,813 total issues

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

  describe "general tab", js: true do
    before(:each) do
      (1..3).each do |i|
        create(:course, name: "Course #{i}")
      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 assignment_team_spec.rb has 354 lines of code (exceeds 250 allowed). Consider refactoring.
Open

describe 'AssignmentTeam' do
  let(:team_without_submitted_hyperlinks) { build(:assignment_team, submitted_hyperlinks: "") }
  let(:team) { build(:assignment_team, id: 1, parent_id: 1) }
  let(:assignment) { build(:assignment, id: 1) }
  let(:participant1) { build(:participant, id: 1) }
Severity: Minor
Found in spec/models/assignment_team_spec.rb - About 4 hrs to fix

    Assignment Branch Condition size for assign_reviewer_dynamically is too high. [39.15/15]
    Open

      def assign_reviewer_dynamically
        assignment = Assignment.find(params[:assignment_id])
        reviewer = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id: assignment.id).first
    
        if params[:i_dont_care].nil? && params[:topic_id].nil? && assignment.topics? && assignment.can_choose_topic_to_review?

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

      def build_tone_analysis_report
        uri =  WEBSERVICE_CONFIG['sentiment_webservice_url'] + "analyze_reviews_bulk"
        index = 0
        @sentiment_summary = []
        keys = @review_final_versions.keys
    Severity: Minor
    Found in app/controllers/popup_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

    Perceived complexity for import_from_hash is too high. [31/7]
    Open

      def import_from_hash(session, params)
        contents_hash = eval(params[:contents_hash])
        if params[:model] == "AssignmentTeam" or params[:model] == "CourseTeam"
          # contents_hash = eval(params[:contents_hash])
          @header_integrated_body = hash_rows_with_headers(contents_hash[:header], contents_hash[:body])

    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

    Function RenderCal has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    function RenderCal()
    {
        var vCalHeader;
        var vCalData;
        var vCalTime;
    Severity: Minor
    Found in app/assets/javascripts/datetimepicker.js - About 4 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 four_node_cycles has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

      def four_node_cycles(assignment_participant)
        collusion_cycles = []
        assignment_participant.reviewers.each do |ap1|
          ap1.reviewers.each do |ap2|
            ap2.reviewers.each do |ap3|
    Severity: Minor
    Found in app/models/collusion_cycle.rb - About 4 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

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

        context 'when teams is not empty' do
          before(:each) do
            allow(AssignmentTeam).to receive(:where).with(parent_id: 1).and_return([team, team1])
          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. [74/25]
    Open

    describe "peer review testing" do
      before(:each) do
        create(:assignment, name: "TestAssignment", directory_path: 'test_assignment')
        create_list(:participant, 3)
        create(:assignment_node)
    Severity: Minor
    Found in spec/features/peer_review_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.

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

      describe "topics tab", js: true do
        before(:each) do
          (1..3).each do |i|
            create(:course, name: "Course #{i}")
          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.

    Function render has 109 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 4 hrs to fix

      Assignment Branch Condition size for checkbox_control is too high. [38.5/15]
      Open

        def checkbox_control(answer, tag_prompt_deployment, stored_tags)
          html = ""
          value = "0"
      
          if stored_tags.count > 0
      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

      Perceived complexity for complete is too high. [30/7]
      Open

        def complete(count, answer = nil, questionnaire_min, questionnaire_max, dropdown_or_scale)
          if self.size.nil?
            cols = '70'
            rows = '1'
          else
      Severity: Minor
      Found in app/models/criterion.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 view is too high. [38.55/15]
      Open

        def view
          # View will check if send_invs and recieved_invs are set before showing
          # only the owner should be able to see those.
          return unless current_user_id? student.user_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

      Method impersonate has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      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]}'."
      Severity: Minor
      Found in app/controllers/impersonate_controller.rb - About 4 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

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

      describe TeamsController do
        describe "POST #create" do
          context "with an assignment team" do
            it "increases count by 1" do
              expect { create :assignment_team, assignment: @assignment }.to change(Team, :count).by(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 find_team_participants is too high. [37.18/15]
      Open

        def self.find_team_participants(assignment_id, ip_address = nil)
          @participants = SignedUpTeam.joins('INNER JOIN sign_up_topics ON signed_up_teams.topic_id = sign_up_topics.id')
                                      .select('signed_up_teams.id as id, sign_up_topics.id as topic_id, sign_up_topics.topic_name as name,
                                        sign_up_topics.topic_name as team_name_placeholder, sign_up_topics.topic_name as user_name_placeholder,
                                        signed_up_teams.is_waitlisted as is_waitlisted, signed_up_teams.team_id as team_id')
      Severity: Minor
      Found in app/models/signed_up_team.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 add_answer is too high. [37.22/15]
      Open

        def add_answer(answer)
          # We want to add each response score from this review (answer) to its corresponding
          # question row.
          @list_of_rows.each do |row|
            next unless row.question_id == answer.question_id
      Severity: Minor
      Found in app/models/vm_question_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 get_bar_chart_url is too high. [37/15]
      Open

        def self.get_bar_chart_url(labels, values, max)
          return  "" if labels.length != values.length
      
          address = "http://chart.apis.google.com/chart?cht=bhs&chxt=x,y&chf=bg,s,dddddd&chtt=Average+response+score+by+question&chs=600x" + (labels.length * 25 + 60).to_s
      
      
      Severity: Minor
      Found in app/helpers/charts_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 view_team is too high. [37.34/15]
      Open

        def view_team
          @participant = AssignmentParticipant.find(params[:id])
          @assignment = @participant.assignment
          @team = @participant.team
          @team_id = @team.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