ece517-p3/expertiza

View on GitHub

Showing 2,813 of 2,813 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  it "is able to delete question from a global survey" do
    survey_name = 'Global Survey Questionnaire 1'
    deploy_global_survey(@next_day, @next_to_next_day, survey_name)
    survey_questionnaire = Questionnaire.where(name: survey_name).first
    visit '/questionnaires/' + survey_questionnaire.id.to_s + '/edit'
Severity: Major
Found in spec/features/global_survey_spec.rb and 1 other location - About 1 hr to fix
spec/features/course_survey_spec.rb on lines 67..81

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 69.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    it "test for bequeath" do
      assignment = build(Assignment)
      course = Course.new
      course.name = "newCourse"
      course.save
Severity: Major
Found in spec/controllers/teams_controller_spec.rb and 1 other location - About 1 hr to fix
spec/controllers/teams_controller_spec.rb on lines 35..60

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 68.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    it "test for inherit" do
      assignment = build(Assignment)
      course = Course.new
      course.name = "newCourse"
      course.save
Severity: Major
Found in spec/controllers/teams_controller_spec.rb and 1 other location - About 1 hr to fix
spec/controllers/teams_controller_spec.rb on lines 64..89

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 68.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function update has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    update: function(value, duration) {
      if (value === true) {//Force update with current value
        this._setPercentage(this.getPercent());
        return this;
      }
Severity: Minor
Found in app/assets/javascripts/circles.js - About 1 hr to fix

    Method save_choices has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    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
    
    
    Severity: Minor
    Found in app/controllers/questionnaires_controller.rb - About 1 hr to fix

      Method create has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def create
          if params[:questionnaire][:name].blank?
            flash[:error] = 'A rubric or survey must have a title.'
            redirect_to controller: 'questionnaires', action: 'new', model: params[:questionnaire][:type], private: params[:questionnaire][:private]
          else
      Severity: Minor
      Found in app/controllers/questionnaires_controller.rb - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                              if (((entry.name && entry.name.indexOf(_this.props.filterText) !== -1) ||
                                  (entry.creation_date && entry.creation_date.indexOf(_this.props.filterText) !== -1) ||
                                  (entry.institution && entry.institution.indexOf(_this.props.filterText) !== -1) ||
                                  (entry.updated_date && entry.updated_date.indexOf(_this.props.filterText) !== -1)) &&
                                  (entry.private == false)) {
        Severity: Critical
        Found in app/assets/javascripts/tree_display.jsx - About 1 hr to fix

          Assignment Branch Condition size for get_peer_review_data is too high. [15.17/15]
          Open

            def self.get_peer_review_data(participant_id, timeline_list)
              ReviewResponseMap.where(reviewer_id: participant_id).find_each do |rm|
                response = Response.where(map_id: rm.id).last
                next if response.nil?
                timeline = {
          Severity: Minor
          Found in app/models/student_task.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 review_response_report is too high. [15.84/15]
          Open

            def self.review_response_report(id, assignment, type, review_user)
              if review_user.nil?
                # This is not a search, so find all reviewers for this assignment
                response_maps_with_distinct_participant_id =
                  ResponseMap.select("DISTINCT reviewer_id").where('reviewed_object_id = ? and type = ? and calibrate_to = ?', id, type, 0)
          Severity: Minor
          Found in app/models/review_response_map.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_user_list is too high. [15.65/15]
          Open

            def self.get_user_list(user)
              courses = Ta.get_mapped_courses(user.id)
              participants = []
              user_list = []
              courses.each do |course_id|
          Severity: Minor
          Found in app/models/ta.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 path is too high. [15.03/15]
          Open

            def path
              raise "Path can not be created. The course must be associated with an instructor." if self.instructor_id.nil?
              Rails.root + "/pg_data/" + FileHelper.clean_path(User.find(self.instructor_id).name) + "/" + FileHelper.clean_path(self.directory_path) + "/"
            end
          Severity: Minor
          Found in app/models/course.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 confirmTopic is too high. [15.39/15]
          Open

            def self.confirmTopic(user_id, team_id, topic_id, assignment_id)
              # check whether user has signed up already
              user_signup = SignUpSheet.otherConfirmedTopicforUser(assignment_id, team_id)
          
              sign_up = SignedUpTeam.new
          Severity: Minor
          Found in app/models/sign_up_sheet.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 is too high. [15.81/15]
          Open

            def self.export(csv, parent_id, options, teamtype)
              if teamtype.is_a?(CourseTeam)
                teams = CourseTeam.where(parent_id: parent_id)
              elsif teamtype.is_a?(AssignmentTeam)
                teams = AssignmentTeam.where(parent_id: parent_id)
          Severity: Minor
          Found in app/models/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 number_of_comments_greater_than_10_words is too high. [15.43/15]
          Open

            def number_of_comments_greater_than_10_words
              @list_of_reviews.each do |review|
                answers = Answer.where(response_id: review.response_id)
                answers.each do |answer|
                  @list_of_rows.each do |row|
          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 export_fields is too high. [15.84/15]
          Open

            def self.export_fields(options)
              fields = []
              fields.push("name", "full name", "email") if options["personal_details"] == "true"
              fields.push("role") if options["role"] == "true"
              fields.push("parent") if options["parent"] == "true"
          Severity: Minor
          Found in app/models/participant.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 cycle_similarity_score is too high. [15.84/15]
          Open

            def cycle_similarity_score(cycle)
              similarity_score = 0.0
              count = 0.0
              for pivot in 0...cycle.size - 1 do
                pivot_score = cycle[pivot][1]
          Severity: Minor
          Found in app/models/collusion_cycle.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_fields is too high. [15.84/15]
          Open

            def self.export_fields(options)
              fields = []
              fields.push("name", "full name", "email") if options["personal_details"] == "true"
              fields.push("role") if options["role"] == "true"
              fields.push("parent") if options["parent"] == "true"
          Severity: Minor
          Found in app/models/user.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 cycle_deviation_score is too high. [15.68/15]
          Open

            def cycle_deviation_score(cycle)
              deviation_score = 0.0
              count = 0.0
              for member in 0...cycle.size do
                participant = AssignmentParticipant.find(cycle[member][0].id)
          Severity: Minor
          Found in app/models/collusion_cycle.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_script is too high. [15.81/15]
          Open

            def complete_script(count)
              html = '<script>function checkbox' + count.to_s + 'Changed() {'
              html += ' var checkbox = jQuery("#responses_' + count.to_s + '_checkbox");'
              html += ' var response_score = jQuery("#responses_' + count.to_s + '_score");'
              html += 'if (checkbox.is(":checked")) {'
          Severity: Minor
          Found in app/models/checkbox.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 distribution is too high. [15.3/15]
          Open

            def distribution(array, num_intervals, x_min = array.min)
              distribution = []
              interval_size = ((array.max - x_min).to_f / num_intervals).ceil
              intervals = (1..num_intervals).to_a.collect {|val| val * interval_size }
              intervals.each do |interval_max|
          Severity: Minor
          Found in app/helpers/analytic_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

          Severity
          Category
          Status
          Source
          Language