expertiza/expertiza

View on GitHub
spec/models/response_analytic_spec.rb

Summary

Maintainability
D
2 days
Test Coverage

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

describe ResponseAnalytic do
  let(:questionnaire) { create(:questionnaire, id: 1) }
  let(:question1) { create(:question, questionnaire: questionnaire, weight: 1, id: 1) }
  let(:response_map) { create(:review_response_map, id: 1, reviewed_object_id: 1) }
  let!(:response_record) { create(:response, id: 1, response_map: response_map) }

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 response_analytic_spec.rb has 293 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class ResponseAnalyticTestDummyClass
  attr_accessor :scores
  require 'analytic/response_analytic'
  include ResponseAnalytic

Severity: Minor
Found in spec/models/response_analytic_spec.rb - About 3 hrs to fix

    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 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 '#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 11 locations. Consider refactoring.
    Open

      describe '#max_character_count' do
        context 'there are no answers associated with the response' do
          it 'will return 0' do
            dc = ResponseAnalyticTestDummyClass.new([])
            expect(dc.max_character_count).to eq(0)
    Severity: Major
    Found in spec/models/response_analytic_spec.rb and 10 other locations - About 1 hr to fix
    spec/models/response_analytic_spec.rb on lines 95..108
    spec/models/response_analytic_spec.rb on lines 112..125
    spec/models/response_analytic_spec.rb on lines 146..159
    spec/models/response_analytic_spec.rb on lines 163..176
    spec/models/response_analytic_spec.rb on lines 180..193
    spec/models/response_analytic_spec.rb on lines 197..210
    spec/models/response_analytic_spec.rb on lines 214..227
    spec/models/response_analytic_spec.rb on lines 231..244
    spec/models/response_analytic_spec.rb on lines 248..261
    spec/models/response_analytic_spec.rb on lines 265..278

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

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

      describe '#max_question_score' do
        context 'there are no answers associated with the response' do
          it 'will return 0' do
            dc = ResponseAnalyticTestDummyClass.new([])
            expect(dc.max_question_score).to eq(0)
    Severity: Major
    Found in spec/models/response_analytic_spec.rb and 10 other locations - About 1 hr to fix
    spec/models/response_analytic_spec.rb on lines 95..108
    spec/models/response_analytic_spec.rb on lines 112..125
    spec/models/response_analytic_spec.rb on lines 129..142
    spec/models/response_analytic_spec.rb on lines 146..159
    spec/models/response_analytic_spec.rb on lines 163..176
    spec/models/response_analytic_spec.rb on lines 180..193
    spec/models/response_analytic_spec.rb on lines 197..210
    spec/models/response_analytic_spec.rb on lines 214..227
    spec/models/response_analytic_spec.rb on lines 231..244
    spec/models/response_analytic_spec.rb on lines 265..278

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

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

      describe '#total_character_count' do
        context 'there are no answers associated with the response' do
          it 'will return 0' do
            dc = ResponseAnalyticTestDummyClass.new([])
            expect(dc.total_character_count).to eq(0)
    Severity: Major
    Found in spec/models/response_analytic_spec.rb and 10 other locations - About 1 hr to fix
    spec/models/response_analytic_spec.rb on lines 112..125
    spec/models/response_analytic_spec.rb on lines 129..142
    spec/models/response_analytic_spec.rb on lines 146..159
    spec/models/response_analytic_spec.rb on lines 163..176
    spec/models/response_analytic_spec.rb on lines 180..193
    spec/models/response_analytic_spec.rb on lines 197..210
    spec/models/response_analytic_spec.rb on lines 214..227
    spec/models/response_analytic_spec.rb on lines 231..244
    spec/models/response_analytic_spec.rb on lines 248..261
    spec/models/response_analytic_spec.rb on lines 265..278

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

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

      describe '#min_word_count' do
        context 'there are no answers associated with the response' do
          it 'will return 0' do
            dc = ResponseAnalyticTestDummyClass.new([])
            expect(dc.min_word_count).to eq(0)
    Severity: Major
    Found in spec/models/response_analytic_spec.rb and 10 other locations - About 1 hr to fix
    spec/models/response_analytic_spec.rb on lines 95..108
    spec/models/response_analytic_spec.rb on lines 112..125
    spec/models/response_analytic_spec.rb on lines 129..142
    spec/models/response_analytic_spec.rb on lines 146..159
    spec/models/response_analytic_spec.rb on lines 163..176
    spec/models/response_analytic_spec.rb on lines 180..193
    spec/models/response_analytic_spec.rb on lines 197..210
    spec/models/response_analytic_spec.rb on lines 231..244
    spec/models/response_analytic_spec.rb on lines 248..261
    spec/models/response_analytic_spec.rb on lines 265..278

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

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

      describe '#average_character_count' do
        context 'there are no answers associated with the response' do
          it 'will return 0' do
            dc = ResponseAnalyticTestDummyClass.new([])
            expect(dc.average_character_count).to eq(0)
    Severity: Major
    Found in spec/models/response_analytic_spec.rb and 10 other locations - About 1 hr to fix
    spec/models/response_analytic_spec.rb on lines 95..108
    spec/models/response_analytic_spec.rb on lines 129..142
    spec/models/response_analytic_spec.rb on lines 146..159
    spec/models/response_analytic_spec.rb on lines 163..176
    spec/models/response_analytic_spec.rb on lines 180..193
    spec/models/response_analytic_spec.rb on lines 197..210
    spec/models/response_analytic_spec.rb on lines 214..227
    spec/models/response_analytic_spec.rb on lines 231..244
    spec/models/response_analytic_spec.rb on lines 248..261
    spec/models/response_analytic_spec.rb on lines 265..278

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

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

      describe '#average_score' do
        context 'there are no answers associated with the response' do
          it 'will return 0' do
            dc = ResponseAnalyticTestDummyClass.new([])
            expect(dc.average_score).to eq(0)
    Severity: Major
    Found in spec/models/response_analytic_spec.rb and 10 other locations - About 1 hr to fix
    spec/models/response_analytic_spec.rb on lines 95..108
    spec/models/response_analytic_spec.rb on lines 112..125
    spec/models/response_analytic_spec.rb on lines 129..142
    spec/models/response_analytic_spec.rb on lines 146..159
    spec/models/response_analytic_spec.rb on lines 163..176
    spec/models/response_analytic_spec.rb on lines 180..193
    spec/models/response_analytic_spec.rb on lines 197..210
    spec/models/response_analytic_spec.rb on lines 214..227
    spec/models/response_analytic_spec.rb on lines 248..261
    spec/models/response_analytic_spec.rb on lines 265..278

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

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

      describe '#max_word_count' do
        context 'there are no answers associated with the response' do
          it 'will return 0' do
            dc = ResponseAnalyticTestDummyClass.new([])
            expect(dc.max_word_count).to eq(0)
    Severity: Major
    Found in spec/models/response_analytic_spec.rb and 10 other locations - About 1 hr to fix
    spec/models/response_analytic_spec.rb on lines 95..108
    spec/models/response_analytic_spec.rb on lines 112..125
    spec/models/response_analytic_spec.rb on lines 129..142
    spec/models/response_analytic_spec.rb on lines 146..159
    spec/models/response_analytic_spec.rb on lines 163..176
    spec/models/response_analytic_spec.rb on lines 180..193
    spec/models/response_analytic_spec.rb on lines 214..227
    spec/models/response_analytic_spec.rb on lines 231..244
    spec/models/response_analytic_spec.rb on lines 248..261
    spec/models/response_analytic_spec.rb on lines 265..278

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

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

      describe '#min_question_score' do
        context 'there are no answers associated with the response' do
          it 'will return 0' do
            dc = ResponseAnalyticTestDummyClass.new([])
            expect(dc.min_question_score).to eq(0)
    Severity: Major
    Found in spec/models/response_analytic_spec.rb and 10 other locations - About 1 hr to fix
    spec/models/response_analytic_spec.rb on lines 95..108
    spec/models/response_analytic_spec.rb on lines 112..125
    spec/models/response_analytic_spec.rb on lines 129..142
    spec/models/response_analytic_spec.rb on lines 146..159
    spec/models/response_analytic_spec.rb on lines 163..176
    spec/models/response_analytic_spec.rb on lines 180..193
    spec/models/response_analytic_spec.rb on lines 197..210
    spec/models/response_analytic_spec.rb on lines 214..227
    spec/models/response_analytic_spec.rb on lines 231..244
    spec/models/response_analytic_spec.rb on lines 248..261

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

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

      describe '#min_character_count' do
        context 'there are no answers associated with the response' do
          it 'will return 0' do
            dc = ResponseAnalyticTestDummyClass.new([])
            expect(dc.min_character_count).to eq(0)
    Severity: Major
    Found in spec/models/response_analytic_spec.rb and 10 other locations - About 1 hr to fix
    spec/models/response_analytic_spec.rb on lines 95..108
    spec/models/response_analytic_spec.rb on lines 112..125
    spec/models/response_analytic_spec.rb on lines 129..142
    spec/models/response_analytic_spec.rb on lines 163..176
    spec/models/response_analytic_spec.rb on lines 180..193
    spec/models/response_analytic_spec.rb on lines 197..210
    spec/models/response_analytic_spec.rb on lines 214..227
    spec/models/response_analytic_spec.rb on lines 231..244
    spec/models/response_analytic_spec.rb on lines 248..261
    spec/models/response_analytic_spec.rb on lines 265..278

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

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

      describe '#total_word_count' do
        context 'there are no answers associated with the response' do
          it 'will return 0' do
            dc = ResponseAnalyticTestDummyClass.new([])
            expect(dc.total_word_count).to eq(0)
    Severity: Major
    Found in spec/models/response_analytic_spec.rb and 10 other locations - About 1 hr to fix
    spec/models/response_analytic_spec.rb on lines 95..108
    spec/models/response_analytic_spec.rb on lines 112..125
    spec/models/response_analytic_spec.rb on lines 129..142
    spec/models/response_analytic_spec.rb on lines 146..159
    spec/models/response_analytic_spec.rb on lines 180..193
    spec/models/response_analytic_spec.rb on lines 197..210
    spec/models/response_analytic_spec.rb on lines 214..227
    spec/models/response_analytic_spec.rb on lines 231..244
    spec/models/response_analytic_spec.rb on lines 248..261
    spec/models/response_analytic_spec.rb on lines 265..278

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

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

      describe '#average_word_count' do
        context 'there are no answers associated with the response' do
          it 'will return 0' do
            dc = ResponseAnalyticTestDummyClass.new([])
            expect(dc.average_word_count).to eq(0)
    Severity: Major
    Found in spec/models/response_analytic_spec.rb and 10 other locations - About 1 hr to fix
    spec/models/response_analytic_spec.rb on lines 95..108
    spec/models/response_analytic_spec.rb on lines 112..125
    spec/models/response_analytic_spec.rb on lines 129..142
    spec/models/response_analytic_spec.rb on lines 146..159
    spec/models/response_analytic_spec.rb on lines 163..176
    spec/models/response_analytic_spec.rb on lines 197..210
    spec/models/response_analytic_spec.rb on lines 214..227
    spec/models/response_analytic_spec.rb on lines 231..244
    spec/models/response_analytic_spec.rb on lines 248..261
    spec/models/response_analytic_spec.rb on lines 265..278

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

    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

    There are no issues that match your filters.

    Category
    Status