expertiza/expertiza

View on GitHub

Showing 531 of 4,497 total issues

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

  it 'check to find if the assignment can be added to a course', js: true do
    create(:assignment, course: nil, name: 'Test Assignment')
    create(:course, name: 'Test Course')

    course_id = Course.where(name: 'test Course')[0].id
Severity: Major
Found in spec/features/assignment_creation_spec.rb and 1 other location - About 1 hr to fix
spec/features/assignment_creation_page_spec.rb on lines 204..221

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

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

    describe '#action_allowed?' do
      context 'when the current user is student' do
        it 'returns false' do
          stub_current_user(student, student.role.name, student.role)
          expect(controller.send(:action_allowed?)).to be_falsey
Severity: Major
Found in spec/controllers/markup_styles_controller_spec.rb and 2 other locations - About 1 hr to fix
spec/controllers/advice_controller_spec.rb on lines 6..25
spec/controllers/lock_controller_spec.rb on lines 10..26

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

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 deploy_survey(start_date, end_date, survey_name)
  login_as('instructor6')
  expect(page).to have_content('Manage content')
  create_assignment_questionnaire survey_name
  survey = Questionnaire.where(name: survey_name)
Severity: Major
Found in spec/features/survey_spec.rb and 1 other location - About 1 hr to fix
spec/features/course_survey_spec.rb on lines 9..21

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

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

  describe '#action_allowed?' do
    context 'when the role of current user is Instructor' do
      it 'allows certain action' do
        stub_current_user(instructor1, instructor1.role.name, instructor1.role)
        expect(controller.send(:action_allowed?)).to be_truthy
Severity: Major
Found in spec/controllers/lock_controller_spec.rb and 2 other locations - About 1 hr to fix
spec/controllers/advice_controller_spec.rb on lines 6..25
spec/controllers/markup_styles_controller_spec.rb on lines 18..34

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

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 'deletes all topics for the non-staggered deadline assignment and redirects to edit assignment page' do
      create(:topic, id: 30, assignment_id: 30, topic_identifier: 'E1740')
      create(:topic, id: 40, assignment_id: 30, topic_identifier: 'E1741')
      create(:topic, id: 50, assignment_id: 30, topic_identifier: 'E1742')
      request_params = { assignment_id: 30 }
Severity: Major
Found in spec/controllers/sign_up_sheet_controller_spec.rb and 1 other location - About 1 hr to fix
spec/controllers/sign_up_sheet_controller_spec.rb on lines 378..387

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

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

  describe '#action_allowed?' do
    context 'when the role of current user is Super-Admin' do
      # Checking for Super-Admin
      it 'allows certain action' do
        stub_current_user(super_admin, super_admin.role.name, super_admin.role)
Severity: Major
Found in spec/controllers/advice_controller_spec.rb and 2 other locations - About 1 hr to fix
spec/controllers/lock_controller_spec.rb on lines 10..26
spec/controllers/markup_styles_controller_spec.rb on lines 18..34

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

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 deploy_course_survey(start_date, end_date, survey_name)
  login_as('instructor6')
  expect(page).to have_content('Manage content')
  create_course_questionnaire survey_name
  survey = Questionnaire.where(name: survey_name)
Severity: Major
Found in spec/features/course_survey_spec.rb and 1 other location - About 1 hr to fix
spec/features/survey_spec.rb on lines 9..22

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

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

  describe '#question_score_list' do
    context 'there are no answers associated with the response' do
      it 'will return [0]' do
        dc = ResponseAnalyticTestDummyClass.new([])
        expect(dc.question_score_list).to eq([0])
Severity: Major
Found in spec/models/response_analytic_spec.rb and 2 other locations - About 1 hr to fix
spec/models/response_analytic_spec.rb on lines 23..36
spec/models/response_analytic_spec.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 63.

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

  describe '#word_count_list' do
    context 'there are no answers associated with the response' do
      it 'will return [0]' do
        dc = ResponseAnalyticTestDummyClass.new([])
        expect(dc.word_count_list).to eq([0])
Severity: Major
Found in spec/models/response_analytic_spec.rb and 2 other locations - About 1 hr to fix
spec/models/response_analytic_spec.rb on lines 40..53
spec/models/response_analytic_spec.rb on lines 57..70

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

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

  describe '#character_count_list' do
    context 'there are no answers associated with the response' do
      it 'will return [0]' do
        dc = ResponseAnalyticTestDummyClass.new([])
        expect(dc.character_count_list).to eq([0])
Severity: Major
Found in spec/models/response_analytic_spec.rb and 2 other locations - About 1 hr to fix
spec/models/response_analytic_spec.rb on lines 23..36
spec/models/response_analytic_spec.rb on lines 57..70

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

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

    it 'teaching assistant should not be able to impersonate an instructor with their real name' do
      stub_current_user(teaching_assistant, teaching_assistant.role.name, teaching_assistant.role)
      allow(User).to receive(:find_by).with(name: instructor.name).and_return(instructor)
      allow(teaching_assistant).to receive(:can_impersonate?).with(instructor).and_return(false)
      request.env['HTTP_REFERER'] = 'http://www.example.com'
Severity: Major
Found in spec/controllers/impersonate_controller_spec.rb and 3 other locations - About 1 hr to fix
spec/controllers/impersonate_controller_spec.rb on lines 112..120
spec/controllers/impersonate_controller_spec.rb on lines 123..131
spec/controllers/impersonate_controller_spec.rb on lines 176..184

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

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

  describe '#average_word_count' do
    context 'when there are no questions' do
      it 'returns 0' do
        dc = QuestionnaireAnalyticTestDummyClass.new([])
        expect(dc.average_word_count).to eq(0)
Severity: Major
Found in spec/models/questionnaire_analytic_spec.rb and 3 other locations - About 1 hr to fix
spec/models/questionnaire_analytic_spec.rb on lines 90..103
spec/models/questionnaire_analytic_spec.rb on lines 142..155
spec/models/questionnaire_analytic_spec.rb on lines 159..172

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

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

  describe '#total_character_count' do
    context 'when there are no questions' do
      it 'returns 0' do
        dc = QuestionnaireAnalyticTestDummyClass.new([])
        expect(dc.total_character_count).to eq(0)
Severity: Major
Found in spec/models/questionnaire_analytic_spec.rb and 3 other locations - About 1 hr to fix
spec/models/questionnaire_analytic_spec.rb on lines 90..103
spec/models/questionnaire_analytic_spec.rb on lines 107..120
spec/models/questionnaire_analytic_spec.rb on lines 159..172

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

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

    it 'teaching assistant should not be able to impersonate an super admin with their real name' do
      stub_current_user(teaching_assistant, teaching_assistant.role.name, teaching_assistant.role)
      allow(User).to receive(:find_by).with(name: super_admin.name).and_return(super_admin)
      allow(teaching_assistant).to receive(:can_impersonate?).with(super_admin).and_return(false)
      request.env['HTTP_REFERER'] = 'http://www.example.com'
Severity: Major
Found in spec/controllers/impersonate_controller_spec.rb and 3 other locations - About 1 hr to fix
spec/controllers/impersonate_controller_spec.rb on lines 101..109
spec/controllers/impersonate_controller_spec.rb on lines 112..120
spec/controllers/impersonate_controller_spec.rb on lines 176..184

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

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

  describe '#average_character_count' do
    context 'when there are no questions' do
      it 'returns 0' do
        dc = QuestionnaireAnalyticTestDummyClass.new([])
        expect(dc.average_character_count).to eq(0)
Severity: Major
Found in spec/models/questionnaire_analytic_spec.rb and 3 other locations - About 1 hr to fix
spec/models/questionnaire_analytic_spec.rb on lines 90..103
spec/models/questionnaire_analytic_spec.rb on lines 107..120
spec/models/questionnaire_analytic_spec.rb on lines 142..155

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

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

    it 'teaching assistant should not be able to impersonate an admin with their real name' do
      stub_current_user(teaching_assistant, teaching_assistant.role.name, teaching_assistant.role)
      allow(User).to receive(:find_by).with(name: admin.name).and_return(admin)
      allow(teaching_assistant).to receive(:can_impersonate?).with(admin).and_return(false)
      request.env['HTTP_REFERER'] = 'http://www.example.com'
Severity: Major
Found in spec/controllers/impersonate_controller_spec.rb and 3 other locations - About 1 hr to fix
spec/controllers/impersonate_controller_spec.rb on lines 101..109
spec/controllers/impersonate_controller_spec.rb on lines 123..131
spec/controllers/impersonate_controller_spec.rb on lines 176..184

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

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

  describe '#total_word_count' do
    context 'when there are no questions' do
      it 'returns 0' do
        dc = QuestionnaireAnalyticTestDummyClass.new([])
        expect(dc.total_word_count).to eq(0)
Severity: Major
Found in spec/models/questionnaire_analytic_spec.rb and 3 other locations - About 1 hr to fix
spec/models/questionnaire_analytic_spec.rb on lines 107..120
spec/models/questionnaire_analytic_spec.rb on lines 142..155
spec/models/questionnaire_analytic_spec.rb on lines 159..172

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

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

    it 'admin should not be able to impersonate a super admin with their real name' do
      stub_current_user(admin, admin.role.name, admin.role)
      allow(User).to receive(:find_by).with(name: super_admin.name).and_return(super_admin)
      allow(admin).to receive(:can_impersonate?).with(super_admin).and_return(false)
      request.env['HTTP_REFERER'] = 'http://www.example.com'
Severity: Major
Found in spec/controllers/impersonate_controller_spec.rb and 3 other locations - About 1 hr to fix
spec/controllers/impersonate_controller_spec.rb on lines 101..109
spec/controllers/impersonate_controller_spec.rb on lines 112..120
spec/controllers/impersonate_controller_spec.rb on lines 123..131

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

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

      header.map!(&:to_sym)
      body.each do |row|
        h = {}
        if params[:has_teamname] == 'true_first'
          h[header[0]] = row.shift
Severity: Major
Found in app/controllers/import_file_controller.rb and 1 other location - About 1 hr to fix
app/controllers/import_file_controller.rb on lines 207..219

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

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

      header.map!(&:to_sym)
      body.each do |row|
        h = {}
        if params[:has_reviewee] == 'true_first'
          h[header[0]] = row.shift
Severity: Major
Found in app/controllers/import_file_controller.rb and 1 other location - About 1 hr to fix
app/controllers/import_file_controller.rb on lines 192..204

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

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