src/app/legacy/containers/StoryPromo/utilities/index.test.js

Summary

Maintainability
C
1 day
Test Coverage

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

  it('should return id of promo-link with contentType and URI if contentType exists for a "Features and Analysis" promo', () => {
    expect(
      buildUniquePromoId({
        sectionType: 'features-and-analysis',
        promoGroupId: labelId,
Severity: Minor
Found in src/app/legacy/containers/StoryPromo/utilities/index.test.js and 1 other location - About 55 mins to fix
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 131..140

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

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('should return id of promo-link with contentType and URI if contentType exists for a "Top Stories" promo', () => {
    expect(
      buildUniquePromoId({
        sectionType: 'top-stories',
        promoGroupId: labelId,
Severity: Minor
Found in src/app/legacy/containers/StoryPromo/utilities/index.test.js and 1 other location - About 55 mins to fix
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 142..151

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

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('should return false if item is undefined', () => {
    expect(isPgl(null)).toBe(false);
    expect(isPgl(undefined)).toBe(false);
  });
Severity: Minor
Found in src/app/legacy/containers/StoryPromo/utilities/index.test.js and 1 other location - About 50 mins to fix
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 30..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 51.

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('should return false if item is undefined', () => {
    expect(isMap(null)).toBe(false);
    expect(isMap(undefined)).toBe(false);
  });
Severity: Minor
Found in src/app/legacy/containers/StoryPromo/utilities/index.test.js and 1 other location - About 50 mins to fix
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 47..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 51.

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

  it('should return id using canonicalUrl if assetUri does not exist and uri does not exist', () => {
    expect(
      buildUniquePromoId({
        promoGroupId: labelId,
        promoItem: tipoFormattedTopStoriesItem,
Severity: Major
Found in src/app/legacy/containers/StoryPromo/utilities/index.test.js and 4 other locations - About 40 mins to fix
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 71..79
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 81..89
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 91..99
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 111..119

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

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

  it('should return id using URI if assetURI does not exist', () => {
    expect(
      buildUniquePromoId({
        promoGroupId: labelId,
        promoItem: standardLinkItem,
Severity: Major
Found in src/app/legacy/containers/StoryPromo/utilities/index.test.js and 4 other locations - About 40 mins to fix
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 71..79
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 91..99
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 101..109
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 111..119

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

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

  it('should return id with contentType only if assetURI and URI do not exist', () => {
    expect(
      buildUniquePromoId({
        promoGroupId: labelId,
        promoItem: secondaryColumnContentType,
Severity: Major
Found in src/app/legacy/containers/StoryPromo/utilities/index.test.js and 4 other locations - About 40 mins to fix
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 71..79
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 81..89
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 91..99
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 101..109

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

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

  it('should return id of promo-link with contentType and URI if contentType exists', () => {
    expect(
      buildUniquePromoId({
        promoGroupId: labelId,
        promoItem: secondaryColumnNoAssetURI,
Severity: Major
Found in src/app/legacy/containers/StoryPromo/utilities/index.test.js and 4 other locations - About 40 mins to fix
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 81..89
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 91..99
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 101..109
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 111..119

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

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

  it('should return id using assetURI does not exist and contentType does not exist', () => {
    expect(
      buildUniquePromoId({
        promoGroupId: labelId,
        promoItem: completeItem,
Severity: Major
Found in src/app/legacy/containers/StoryPromo/utilities/index.test.js and 4 other locations - About 40 mins to fix
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 71..79
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 81..89
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 101..109
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 111..119

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

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("should return false if media doesn't exist and cpsType isn't MAP", () => {
    const pgl = { cpsType: PHOTO_GALLERY_PAGE };
    expect(isMap(pgl)).toBe(false);
  });
Severity: Major
Found in src/app/legacy/containers/StoryPromo/utilities/index.test.js and 3 other locations - About 30 mins to fix
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 15..18
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 37..40
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 42..45

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

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('should return true if cpsType is MAP', () => {
    const map = { cpsType: MEDIA_ASSET_PAGE };
    expect(isMap(map)).toBe(true);
  });
Severity: Major
Found in src/app/legacy/containers/StoryPromo/utilities/index.test.js and 3 other locations - About 30 mins to fix
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 25..28
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 37..40
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 42..45

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

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("should return false if cpsType isn't PGL", () => {
    const map = { cpsType: MEDIA_ASSET_PAGE };
    expect(isPgl(map)).toBe(false);
  });
Severity: Major
Found in src/app/legacy/containers/StoryPromo/utilities/index.test.js and 3 other locations - About 30 mins to fix
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 15..18
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 25..28
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 37..40

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

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('should return true if cpsType is PGL', () => {
    const pgl = { cpsType: PHOTO_GALLERY_PAGE };
    expect(isPgl(pgl)).toBe(true);
  });
Severity: Major
Found in src/app/legacy/containers/StoryPromo/utilities/index.test.js and 3 other locations - About 30 mins to fix
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 15..18
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 25..28
src/app/legacy/containers/StoryPromo/utilities/index.test.js on lines 42..45

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

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