Showing 2,206 of 2,206 total issues

Function CurationPromo has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

const CurationPromo = ({
  id,
  title,
  lastPublished,
  imageUrl,
Severity: Minor
Found in src/app/components/Curation/CurationPromo/index.tsx - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function Byline has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

const Byline = ({
  blocks,
  children = null,
}: PropsWithChildren<OptimoBylineBlock['model']>) => {
  const { translations, dir } = useContext(ServiceContext);
Severity: Minor
Found in src/app/components/Byline/index.tsx - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

const RegularParagraph = styled.p`
  ${({ script }) => script && getBodyCopy(script)};
  ${({ service }) => getSansRegular(service)}
`;
src/app/legacy/psammead/psammead-styles/src/index.stories.jsx on lines 92..95
src/app/legacy/psammead/psammead-styles/src/index.stories.jsx on lines 96..99
src/app/legacy/psammead/psammead-styles/src/index.stories.jsx on lines 100..103

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

const BoldItalicParagraph = styled.p`
  ${({ script }) => script && getBodyCopy(script)};
  ${({ service }) => getSansBoldItalic(service)}
`;
src/app/legacy/psammead/psammead-styles/src/index.stories.jsx on lines 88..91
src/app/legacy/psammead/psammead-styles/src/index.stories.jsx on lines 92..95
src/app/legacy/psammead/psammead-styles/src/index.stories.jsx on lines 96..99

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

    it('should return short date in expected format', () => {
      const result = formatUnixTimestamp({
        timestamp: GMTTimestamp,
        format: 'YYYY-MM-DD',
        timezone,
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 41..49
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 51..59
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 61..69
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 81..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 7 locations. Consider refactoring.
Open

export const getSerifBold = service => {
  if (!fonts[service]) {
    return null;
  }
  const { serifBold } = fonts[service];
Severity: Major
Found in src/app/legacy/psammead/psammead-styles/src/font-styles.js and 6 other locations - About 1 hr to fix
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 26..32
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 34..40
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 42..48
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 50..56
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 58..64
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 74..80

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

    it('should return date and time in expected format', () => {
      const result = formatUnixTimestamp({
        timestamp: GMTTimestamp,
        format: 'D MMMM YYYY, HH:mm z',
        timezone,
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 41..49
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 51..59
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 71..79
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 81..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 5 locations. Consider refactoring.
Open

    it('should return long date in expected format', () => {
      const result = formatUnixTimestamp({
        timestamp: GMTTimestamp,
        format: 'D MMMM YYYY',
        timezone,
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 41..49
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 51..59
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 61..69
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 71..79

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

export const getSerifMediumItalic = service => {
  if (!fonts[service]) {
    return null;
  }
  const { serifMediumItalic } = fonts[service];
Severity: Major
Found in src/app/legacy/psammead/psammead-styles/src/font-styles.js and 6 other locations - About 1 hr to fix
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 26..32
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 34..40
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 42..48
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 50..56
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 66..72
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 74..80

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

export const getSerifLight = service => {
  if (!fonts[service]) {
    return null;
  }
  const { serifLight } = fonts[service];
Severity: Major
Found in src/app/legacy/psammead/psammead-styles/src/font-styles.js and 6 other locations - About 1 hr to fix
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 26..32
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 34..40
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 42..48
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 50..56
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 58..64
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 66..72

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

    it('should return BST for a BST timestamp', () => {
      const result = formatUnixTimestamp({
        timestamp: BSTTimestamp,
        format: 'D MMMM YYYY, HH:mm z',
        timezone,
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 51..59
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 61..69
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 71..79
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 81..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 4 locations. Consider refactoring.
Open

const BoldParagraph = styled.p`
  ${({ script }) => script && getBodyCopy(script)};
  ${({ service }) => getSansBold(service)}
`;
src/app/legacy/psammead/psammead-styles/src/index.stories.jsx on lines 88..91
src/app/legacy/psammead/psammead-styles/src/index.stories.jsx on lines 96..99
src/app/legacy/psammead/psammead-styles/src/index.stories.jsx on lines 100..103

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

export const getSerifMedium = service => {
  if (!fonts[service]) {
    return null;
  }
  const { serifMedium } = fonts[service];
Severity: Major
Found in src/app/legacy/psammead/psammead-styles/src/font-styles.js and 6 other locations - About 1 hr to fix
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 26..32
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 34..40
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 42..48
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 58..64
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 66..72
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 74..80

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

export const getSansBoldItalic = service => {
  if (!fonts[service]) {
    return null;
  }
  const { sansBoldItalic } = fonts[service];
Severity: Major
Found in src/app/legacy/psammead/psammead-styles/src/font-styles.js and 6 other locations - About 1 hr to fix
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 34..40
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 42..48
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 50..56
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 58..64
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 66..72
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 74..80

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

export const getSansLight = service => {
  if (!fonts[service]) {
    return null;
  }
  const { sansLight } = fonts[service];
Severity: Major
Found in src/app/legacy/psammead/psammead-styles/src/font-styles.js and 6 other locations - About 1 hr to fix
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 26..32
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 42..48
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 50..56
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 58..64
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 66..72
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 74..80

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

export const getSerifRegular = service => {
  if (!fonts[service]) {
    return null;
  }
  const { serifRegular } = fonts[service];
Severity: Major
Found in src/app/legacy/psammead/psammead-styles/src/font-styles.js and 6 other locations - About 1 hr to fix
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 26..32
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 34..40
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 50..56
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 58..64
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 66..72
src/app/legacy/psammead/psammead-styles/src/font-styles.js on lines 74..80

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

    it('should return GMT for a GMT timestamp', () => {
      const result = formatUnixTimestamp({
        timestamp: GMTTimestamp,
        format: 'D MMMM YYYY, HH:mm z',
        timezone,
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 41..49
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 61..69
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 71..79
src/app/legacy/psammead/psammead-timestamp-container/src/utilities/index.test.js on lines 81..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 4 locations. Consider refactoring.
Open

const ItalicParagraph = styled.p`
  ${({ script }) => script && getBodyCopy(script)};
  ${({ service }) => getSansRegularItalic(service)}
`;
src/app/legacy/psammead/psammead-styles/src/index.stories.jsx on lines 88..91
src/app/legacy/psammead/psammead-styles/src/index.stories.jsx on lines 92..95
src/app/legacy/psammead/psammead-styles/src/index.stories.jsx on lines 100..103

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

export const ExternalLinkNews = () => (
  <ServiceContextProvider service="news">
    <Component
      locator="https://www.example.com/"
      blocks={[fragmentBlock('This is an external link', [])]}
Severity: Major
Found in src/app/legacy/containers/InlineLink/index.stories.jsx and 1 other location - About 1 hr to fix
src/app/legacy/containers/InlineLink/index.stories.jsx on lines 74..82

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

Severity
Category
Status
Source
Language