expertiza/expertiza

View on GitHub

Showing 531 of 4,497 total issues

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

    it 'admin should be able to impersonate a student with their real name' do
      stub_current_user(admin, admin.role.name, admin.role)       
      allow(User).to receive(:find_by).with(name: student1.name).and_return(student1)
      allow(admin).to receive(:can_impersonate?).with(student1).and_return(true)
      request.env['HTTP_REFERER'] = 'http://www.example.com'
Severity: Major
Found in spec/controllers/impersonate_controller_spec.rb and 7 other locations - About 2 hrs to fix
spec/controllers/impersonate_controller_spec.rb on lines 87..98
spec/controllers/impersonate_controller_spec.rb on lines 148..159
spec/controllers/impersonate_controller_spec.rb on lines 162..173
spec/controllers/impersonate_controller_spec.rb on lines 187..198
spec/controllers/impersonate_controller_spec.rb on lines 201..212
spec/controllers/impersonate_controller_spec.rb on lines 215..226
spec/controllers/impersonate_controller_spec.rb on lines 229..240

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 83.

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 8 locations. Consider refactoring.
Open

    it 'admin should be able to impersonate a teaching assistant with their real name' do
      stub_current_user(admin, admin.role.name, admin.role)
      allow(User).to receive(:find_by).with(name: teaching_assistant.name).and_return(teaching_assistant)
      allow(admin).to receive(:can_impersonate?).with(teaching_assistant).and_return(true)
      request.env['HTTP_REFERER'] = 'http://www.example.com'
Severity: Major
Found in spec/controllers/impersonate_controller_spec.rb and 7 other locations - About 2 hrs to fix
spec/controllers/impersonate_controller_spec.rb on lines 87..98
spec/controllers/impersonate_controller_spec.rb on lines 134..145
spec/controllers/impersonate_controller_spec.rb on lines 162..173
spec/controllers/impersonate_controller_spec.rb on lines 187..198
spec/controllers/impersonate_controller_spec.rb on lines 201..212
spec/controllers/impersonate_controller_spec.rb on lines 215..226
spec/controllers/impersonate_controller_spec.rb on lines 229..240

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 83.

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 8 locations. Consider refactoring.
Open

    it 'super admin should be able to impersonate an instructor with their real name' do
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)
      allow(User).to receive(:find_by).with(name: instructor.name).and_return(instructor)
      allow(super_admin).to receive(:can_impersonate?).with(instructor).and_return(true)
      request.env['HTTP_REFERER'] = 'http://www.example.com'
Severity: Major
Found in spec/controllers/impersonate_controller_spec.rb and 7 other locations - About 2 hrs to fix
spec/controllers/impersonate_controller_spec.rb on lines 87..98
spec/controllers/impersonate_controller_spec.rb on lines 134..145
spec/controllers/impersonate_controller_spec.rb on lines 148..159
spec/controllers/impersonate_controller_spec.rb on lines 162..173
spec/controllers/impersonate_controller_spec.rb on lines 187..198
spec/controllers/impersonate_controller_spec.rb on lines 201..212
spec/controllers/impersonate_controller_spec.rb on lines 229..240

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 83.

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 8 locations. Consider refactoring.
Open

    it 'admin should be able to impersonate an instructor with their real name' do
      stub_current_user(admin, admin.role.name, admin.role)
      allow(User).to receive(:find_by).with(name: instructor.name).and_return(instructor)
      allow(admin).to receive(:can_impersonate?).with(instructor).and_return(true)
      request.env['HTTP_REFERER'] = 'http://www.example.com'
Severity: Major
Found in spec/controllers/impersonate_controller_spec.rb and 7 other locations - About 2 hrs to fix
spec/controllers/impersonate_controller_spec.rb on lines 87..98
spec/controllers/impersonate_controller_spec.rb on lines 134..145
spec/controllers/impersonate_controller_spec.rb on lines 148..159
spec/controllers/impersonate_controller_spec.rb on lines 187..198
spec/controllers/impersonate_controller_spec.rb on lines 201..212
spec/controllers/impersonate_controller_spec.rb on lines 215..226
spec/controllers/impersonate_controller_spec.rb on lines 229..240

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 83.

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

  def complete
    quiz_question_choices = QuizQuestionChoice.where(question_id: id)
    html = '<label for="' + id.to_s + '">' + txt + '</label><br>'
    # for i in 0..3
    [0, 1, 2, 3].each do |i|
Severity: Major
Found in app/models/multiple_choice_checkbox.rb and 1 other location - About 2 hrs to fix
app/models/multiple_choice_radio.rb on lines 37..50

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 83.

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

  def complete
    quiz_question_choices = QuizQuestionChoice.where(question_id: id)
    html = '<label for="' + id.to_s + '">' + txt + '</label><br>'
    # for i in 0..3
    [0, 1, 2, 3].each do |i|
Severity: Major
Found in app/models/multiple_choice_radio.rb and 1 other location - About 2 hrs to fix
app/models/multiple_choice_checkbox.rb on lines 40..53

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 83.

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

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

    it 'set the deadline for an assignment review' do
      fill_in 'assignment_form_assignment_rounds_of_reviews', with: '1'
      click_button 'set_rounds'
      fill_in 'datetimepicker_submission_round_1', with: (Time.now.in_time_zone + 1.day).strftime('%Y/%m/%d %H:%M')
      fill_in 'datetimepicker_review_round_1', with: (Time.now.in_time_zone + 10.days).strftime('%Y/%m/%d %H:%M')
Severity: Major
Found in spec/features/assignment_creation_spec.rb and 1 other location - About 2 hrs to fix
spec/features/assignment_creation_dates_spec.rb on lines 32..52

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 81.

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

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

  it 'set the deadline for an assignment review' do
    fill_in 'assignment_form_assignment_rounds_of_reviews', with: '1'
    click_button 'set_rounds'
    fill_in 'datetimepicker_submission_round_1', with: (Time.now.in_time_zone + 1.day).strftime('%Y/%m/%d %H:%M')
    fill_in 'datetimepicker_review_round_1', with: (Time.now.in_time_zone + 10.days).strftime('%Y/%m/%d %H:%M')
Severity: Major
Found in spec/features/assignment_creation_dates_spec.rb and 1 other location - About 2 hrs to fix
spec/features/assignment_creation_spec.rb on lines 695..715

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 81.

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

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

    it 'is able to create a public assignment' do
      login_as('instructor6')
      visit '/assignments/new?private=0'

      fill_in 'assignment_form_assignment_name', with: 'public assignment for test'
Severity: Major
Found in spec/features/assignment_creation_spec.rb and 1 other location - About 2 hrs to fix
spec/features/assignment_creation_page_spec.rb on lines 13..37

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 80.

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

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

  it 'is able to create a public assignment' do
    login_as('instructor6')
    visit '/assignments/new?private=0'

    fill_in 'assignment_form_assignment_name', with: 'public assignment for test'
Severity: Major
Found in spec/features/assignment_creation_page_spec.rb and 1 other location - About 2 hrs to fix
spec/features/assignment_creation_spec.rb on lines 56..80

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 80.

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 'assigns a mentor to a team when the team size passes 50% max capacity' do
      allow(Assignment).to receive(:find).with(assignment.id).and_return(assignment)
      allow(Team).to receive(:find).with(team.id).and_return(team)

      # add 2 students to our team
Severity: Major
Found in spec/models/mentor_management_spec.rb and 1 other location - About 2 hrs to fix
spec/models/mentor_management_spec.rb on lines 245..258

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 77.

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 'can delete existing topic', js: true do
    create(:assignment_due_date, deadline_type: DeadlineType.where(name: 'submission').first, due_at: DateTime.now.in_time_zone + 1.day)
    click_link 'Due date'
    fill_in 'assignment_form_assignment_rounds_of_reviews', with: '1'
    click_button 'set_rounds'
Severity: Major
Found in spec/features/assignment_creation_topics_spec.rb and 1 other location - About 2 hrs to fix
spec/features/assignment_creation_spec.rb on lines 502..518

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 77.

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 'assigns a mentor and notifies the team of the mentor assignment' do
        # test scenario
        allow(Assignment).to receive(:find).with(assignment.id).and_return(assignment)
        allow(Team).to receive(:find).with(team.id).and_return(team)

Severity: Major
Found in spec/models/mentor_management_spec.rb and 1 other location - About 2 hrs to fix
spec/models/mentor_management_spec.rb on lines 71..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 77.

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 'Delete existing topic', js: true do
      create(:assignment_due_date, deadline_type: DeadlineType.where(name: 'submission').first, due_at: DateTime.now.in_time_zone + 1.day)
      click_link 'Due date'
      fill_in 'assignment_form_assignment_rounds_of_reviews', with: '1'
      click_button 'set_rounds'
Severity: Major
Found in spec/features/assignment_creation_spec.rb and 1 other location - About 2 hrs to fix
spec/features/assignment_creation_topics_spec.rb on lines 91..107

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 77.

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 3 locations. Consider refactoring.
Open

    context 'to update the comment in advertisement by a valid member of the current team in user_session' do
      it 'updates the advertisement successfully' do
        allow(AssignmentTeam).to receive(:find_by).and_return(team1)
        allow(AssignmentParticipant).to receive(:exists?).and_return(true)
        allow(team1).to receive(:assignment).and_return(assignment1)
Severity: Major
Found in spec/controllers/advertise_for_partner_controller_spec.rb and 2 other locations - About 1 hr to fix
spec/controllers/advertise_for_partner_controller_spec.rb on lines 86..98
spec/controllers/advertise_for_partner_controller_spec.rb on lines 146..161

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 76.

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 3 locations. Consider refactoring.
Open

    context 'when called by a valid member of the current team in user_session' do
      it 'allows to successfully remove the advertisement' do
        allow(AssignmentTeam).to receive(:find_by).and_return(team1)
        allow(AssignmentParticipant).to receive(:exists?).and_return(true)
        allow(team1).to receive(:assignment).and_return(assignment1)
Severity: Major
Found in spec/controllers/advertise_for_partner_controller_spec.rb and 2 other locations - About 1 hr to fix
spec/controllers/advertise_for_partner_controller_spec.rb on lines 86..98
spec/controllers/advertise_for_partner_controller_spec.rb on lines 105..120

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 76.

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 3 locations. Consider refactoring.
Open

    context 'by a an existing team with advertisement comment' do
      it 'will create an advertisement for the team in current session' do
        allow(AssignmentTeam).to receive(:find_by).and_return(team1)
        allow(AssignmentParticipant).to receive(:exists?).and_return(true)
        allow(team1).to receive(:assignment).and_return(assignment1)
Severity: Major
Found in spec/controllers/advertise_for_partner_controller_spec.rb and 2 other locations - About 1 hr to fix
spec/controllers/advertise_for_partner_controller_spec.rb on lines 105..120
spec/controllers/advertise_for_partner_controller_spec.rb on lines 146..161

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 76.

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 'instructor should be able to impersonate a teaching assistant user with their real name' do
      allow(User).to receive(:find_by).with(name: teaching_assistant.name).and_return(teaching_assistant)
      allow(instructor).to receive(:can_impersonate?).with(teaching_assistant).and_return(true)
      request.env['HTTP_REFERER'] = 'http://www.example.com'
      @params = { user: { name: teaching_assistant.name } }
Severity: Major
Found in spec/controllers/impersonate_controller_spec.rb and 1 other location - About 1 hr to fix
spec/controllers/impersonate_controller_spec.rb on lines 41..51

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 76.

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 'instructor should be able to impersonate a user with their real name' do
      allow(User).to receive(:find_by).with(name: student1.name).and_return(student1)
      allow(instructor).to receive(:can_impersonate?).with(student1).and_return(true)
      request.env['HTTP_REFERER'] = 'http://www.example.com'
      @params = { user: { name: student1.name } }
Severity: Major
Found in spec/controllers/impersonate_controller_spec.rb and 1 other location - About 1 hr to fix
spec/controllers/impersonate_controller_spec.rb on lines 74..84

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 76.

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

  describe '#word_count_list' do
    context 'when there are no questions' do
      it 'returns an array that is [0]' do
        dc = QuestionnaireAnalyticTestDummyClass.new([])
        expect(dc.word_count_list).to eq([0])
Severity: Major
Found in spec/models/questionnaire_analytic_spec.rb and 1 other location - About 1 hr to fix
spec/models/questionnaire_analytic_spec.rb on lines 124..138

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 73.

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

Severity
Category
Status
Source
Language