nycJSorg/angular-presentation

View on GitHub
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts

Summary

Maintainability
D
2 days
Test Coverage

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

    it('handles simple case when the first user is right', () => {
      const v = calculateUserScore(testConfig, presenterData, {
        a: userData.dogIsRight
      });
      expect(v).toEqual({ dog: 100, cat: 0, pikachu: 0, mouse: 0 });
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 140..145

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

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('Ignores answers that are outside of the range', () => {
      const v = calculateUserScore(testConfig, presenterData, {
        b: userData.outsideOfRange
      });
      expect(v).toEqual({ dog: 0, cat: 0, pikachu: 0, mouse: 100 });
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 92..97

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

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('2 users gave correct answer, but cat was faster', () => {
      const v = calculateUserScore(testConfig, presenterData, {
        b: userData.everyoneIsRight
      });
      expect(v).toEqual({ dog: 100, cat: 75, pikachu: 50 });
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 99..104
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 106..111
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 113..118

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

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('two users gave correct answer immediately', () => {
      const v = calculateUserScore(testConfig, presenterData, {
        b: userData.catAndDogAreRightImmediately
      });
      expect(v).toEqual({ dog: 100, cat: 100, pikachu: 0 });
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 99..104
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 113..118
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 120..125

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

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('handles simple case when the second user is right immideately', () => {
      const v = calculateUserScore(testConfig, presenterData, {
        b: userData.catIsRightImmediately
      });
      expect(v).toEqual({ dog: 0, cat: 100, pikachu: 0 });
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 106..111
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 113..118
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 120..125

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

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('second user gave correct answer at the same time', () => {
      const v = calculateUserScore(testConfig, presenterData, {
        b: userData.catAndDogAreRightAtTheSameTime
      });
      expect(v).toEqual({ dog: 100, cat: 100, pikachu: 0 });
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 99..104
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 106..111
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 120..125

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

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

    dogIsRight: {
      dog: { answer: 0, time: 102 },
      cat: { answer: 1, time: 100 },
      pikachu: { answer: 1, time: 100 },
      mouse: { answer: 1, time: 100 }
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 39..44

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

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

    outsideOfRange: {
      dog: { answer: 1, time: 30 },
      cat: { answer: 1, time: 25000 },
      pikachu: { answer: 1, time: 99 },
      mouse: { answer: 1, time: 121 }
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 8..13

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

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

    catIsRightImmediately: {
      dog: { answer: 0, time: 104 },
      cat: { answer: 1, time: 100 },
      pikachu: { answer: 2, time: 100 }
    },
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 19..23
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 24..28
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 29..33
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 34..38

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

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

    catAndDogAreRightImmediately: {
      dog: { answer: 1, time: 100 },
      cat: { answer: 1, time: 100 },
      pikachu: { answer: 2, time: 100 }
    },
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 14..18
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 24..28
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 29..33
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 34..38

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

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

    catAndDogAreRightAtCatIsFaster: {
      dog: { answer: 1, time: 120 },
      cat: { answer: 1, time: 110 },
      pikachu: { answer: 2, time: 100 }
    },
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 14..18
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 19..23
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 24..28
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 34..38

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

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

    everyoneIsRight: {
      dog: { answer: 1, time: 101 },
      cat: { answer: 1, time: 103 },
      pikachu: { answer: 1, time: 105 }
    },
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 14..18
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 19..23
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 24..28
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 29..33

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

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

    catAndDogAreRightAtTheSameTime: {
      dog: { answer: 1, time: 120 },
      cat: { answer: 1, time: 120 },
      pikachu: { answer: 2, time: 100 }
    },
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 14..18
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 19..23
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 29..33
libs/utils/src/lib/sync/components/poll/common/sync-poll.service.spec.ts on lines 34..38

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

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