src/app/legacy/containers/ArticleTimestamp/helpers.test.js

Summary

Maintainability
C
1 day
Test Coverage

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

    it(`should return date and time with timezone format when firstPublished and lastPublished are on the same day and today`, () => {
      const firstPublished = timestampGenerator({ hours: 4 });
      const lastPublished = timestampGenerator({ hours: 2 });
      expect(
        formatType({ firstPublished, lastPublished, datetimeLocale: 'en-gb' }),
Severity: Major
Found in src/app/legacy/containers/ArticleTimestamp/helpers.test.js and 1 other location - About 2 hrs to fix
src/app/legacy/containers/ArticleTimestamp/helpers.test.js on lines 131..137

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

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 date format when lastPublished and firstPublished are not on the same day`, () => {
      const firstPublished = timestampGenerator({ days: 4 });
      const lastPublished = timestampGenerator({ days: 2 });
      expect(
        formatType({ firstPublished, lastPublished, datetimeLocale: 'en-gb' }),
Severity: Major
Found in src/app/legacy/containers/ArticleTimestamp/helpers.test.js and 1 other location - About 2 hrs to fix
src/app/legacy/containers/ArticleTimestamp/helpers.test.js on lines 139..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 91.

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 date format when firstPublished is not today`, () => {
      const firstPublished = timestampGenerator({ days: 5 });
      expect(formatType({ firstPublished, datetimeLocale: 'en-gb' })).toBe(
        dateFormats.date,
      );
Severity: Major
Found in src/app/legacy/containers/ArticleTimestamp/helpers.test.js and 1 other location - About 1 hr to fix
src/app/legacy/containers/ArticleTimestamp/helpers.test.js on lines 124..129

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

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 date and time with timezone format when firstPublished is today`, () => {
      const firstPublished = timestampGenerator({ hours: 4 });
      expect(formatType({ firstPublished, datetimeLocale: 'en-gb' })).toBe(
        dateFormats.dateTimeTimezone,
      );
Severity: Major
Found in src/app/legacy/containers/ArticleTimestamp/helpers.test.js and 1 other location - About 1 hr to fix
src/app/legacy/containers/ArticleTimestamp/helpers.test.js on lines 117..122

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

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 both timestamps are not on the same day', () => {
      const fourHoursAgo = timestampGenerator({ hours: 4 });
      const thirtySixHoursAgo = timestampGenerator({ hours: 36 });
      expect(isSameDay(fourHoursAgo, thirtySixHoursAgo)).toBe(false);
    });
Severity: Major
Found in src/app/legacy/containers/ArticleTimestamp/helpers.test.js and 1 other location - About 1 hr to fix
src/app/legacy/containers/ArticleTimestamp/helpers.test.js on lines 62..66

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

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 when lastPublished !== firstPublished`, () => {
      const firstPublished = timestampGenerator({ hours: 2 });
      const lastPublished = timestampGenerator({ days: 3 });
      expect(isFirstRelative(lastPublished, firstPublished)).toBe(false);
    });
Severity: Major
Found in src/app/legacy/containers/ArticleTimestamp/helpers.test.js and 1 other location - About 1 hr to fix
src/app/legacy/containers/ArticleTimestamp/helpers.test.js on lines 85..89

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 60.

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 timestamp is not today (32 hours ago)', () => {
      const timestamp = timestampGenerator({ hours: 32 });
      expect(isToday(timestamp)).toBe(false);
    });
Severity: Minor
Found in src/app/legacy/containers/ArticleTimestamp/helpers.test.js and 1 other location - About 40 mins to fix
src/app/legacy/containers/ArticleTimestamp/helpers.test.js on lines 93..96

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

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 true if timestamp is today (3 minutes ago)', () => {
      const timestamp = timestampGenerator({ minutes: 3 });
      expect(isToday(timestamp)).toBe(true);
    });
Severity: Minor
Found in src/app/legacy/containers/ArticleTimestamp/helpers.test.js and 1 other location - About 40 mins to fix
src/app/legacy/containers/ArticleTimestamp/helpers.test.js on lines 98..101

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

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