bbc/psammead

View on GitHub

Showing 201 of 201 total issues

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

const ListItem = styled.li`
  text-align: center;
  width: 100%;
  word-break: break-word;
  & button {
Severity: Major
Found in packages/components/psammead-consent-banner/src/index.jsx and 2 other locations - About 1 hr to fix
packages/components/psammead-consent-banner/src/index.jsx on lines 115..143
packages/components/psammead-consent-banner/src/index.jsx on lines 145..154

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

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 getSansBold = service => {
  if (!fonts[service]) {
    return null;
  }
  const { sansBold, sansRegular } = fonts[service];
Severity: Major
Found in packages/utilities/psammead-styles/src/font-styles.js and 1 other location - About 1 hr to fix
packages/utilities/psammead-styles/src/font-styles.js on lines 10..16

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

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

  urdu: {
    text: 'وزیراعظم ریٹائرڈ جرنیل کو فوج کا سربراہ مقرر کر سکتے ہیں',
    longText:
      'پاکستان کے چیف جسٹس نے کہا ہے کہ اگر اٹارنی جنرل برّی فوج کے سربراہ کی مدتِ ملازمت میں توسیع کے معاملے پر جمعرات تک عدالت کو مطمئن نہ کر سکے تو عدالت قانون کے مطابق فیصلہ کر دے گی۔',
    script: 'arabic',
packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 46..59
packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 321..335
packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 336..350

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

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 getSansRegularItalic = service => {
  if (!fonts[service]) {
    return null;
  }
  const { sansRegularItalic, sansRegular } = fonts[service];
Severity: Major
Found in packages/utilities/psammead-styles/src/font-styles.js and 1 other location - About 1 hr to fix
packages/utilities/psammead-styles/src/font-styles.js on lines 18..24

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

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 packages/utilities/psammead-styles/src/font-styles.js and 6 other locations - About 1 hr to fix
packages/utilities/psammead-styles/src/font-styles.js on lines 26..32
packages/utilities/psammead-styles/src/font-styles.js on lines 34..40
packages/utilities/psammead-styles/src/font-styles.js on lines 42..48
packages/utilities/psammead-styles/src/font-styles.js on lines 50..56
packages/utilities/psammead-styles/src/font-styles.js on lines 58..64
packages/utilities/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 packages/utilities/psammead-styles/src/font-styles.js and 6 other locations - About 1 hr to fix
packages/utilities/psammead-styles/src/font-styles.js on lines 26..32
packages/utilities/psammead-styles/src/font-styles.js on lines 34..40
packages/utilities/psammead-styles/src/font-styles.js on lines 50..56
packages/utilities/psammead-styles/src/font-styles.js on lines 58..64
packages/utilities/psammead-styles/src/font-styles.js on lines 66..72
packages/utilities/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 getSerifMedium = service => {
  if (!fonts[service]) {
    return null;
  }
  const { serifMedium } = fonts[service];
Severity: Major
Found in packages/utilities/psammead-styles/src/font-styles.js and 6 other locations - About 1 hr to fix
packages/utilities/psammead-styles/src/font-styles.js on lines 26..32
packages/utilities/psammead-styles/src/font-styles.js on lines 34..40
packages/utilities/psammead-styles/src/font-styles.js on lines 42..48
packages/utilities/psammead-styles/src/font-styles.js on lines 58..64
packages/utilities/psammead-styles/src/font-styles.js on lines 66..72
packages/utilities/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 getSerifMediumItalic = service => {
  if (!fonts[service]) {
    return null;
  }
  const { serifMediumItalic } = fonts[service];
Severity: Major
Found in packages/utilities/psammead-styles/src/font-styles.js and 6 other locations - About 1 hr to fix
packages/utilities/psammead-styles/src/font-styles.js on lines 26..32
packages/utilities/psammead-styles/src/font-styles.js on lines 34..40
packages/utilities/psammead-styles/src/font-styles.js on lines 42..48
packages/utilities/psammead-styles/src/font-styles.js on lines 50..56
packages/utilities/psammead-styles/src/font-styles.js on lines 66..72
packages/utilities/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 packages/utilities/psammead-styles/src/font-styles.js and 6 other locations - About 1 hr to fix
packages/utilities/psammead-styles/src/font-styles.js on lines 26..32
packages/utilities/psammead-styles/src/font-styles.js on lines 34..40
packages/utilities/psammead-styles/src/font-styles.js on lines 42..48
packages/utilities/psammead-styles/src/font-styles.js on lines 50..56
packages/utilities/psammead-styles/src/font-styles.js on lines 58..64
packages/utilities/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 2 locations. Consider refactoring.
Open

  clock: (
    <ClockIcon viewBox="0 0 13 13" width="13" height="13" {...defaultAttrs}>
      <path d="M6.5 0A6.5 6.5 0 1013 6.5 6.5 6.5 0 006.5 0zm0 11.5a5 5 0 115-5 5 5 0 01-5 5z" />
      <path d="M7.34 2.9h-1v3.8L9.4 8.57l.41-.56-2.47-1.89V2.9z" />
    </ClockIcon>
Severity: Major
Found in packages/utilities/psammead-assets/src/svgs/coreIcons.jsx and 1 other location - About 1 hr to fix
packages/utilities/psammead-assets/src/svgs/mediaIcons.jsx on lines 63..73

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

  audio: (
    <AudioMediaIcon
      viewBox="0 0 13 12"
      width="13px"
      height="12px"
Severity: Major
Found in packages/utilities/psammead-assets/src/svgs/mediaIcons.jsx and 1 other location - About 1 hr to fix
packages/utilities/psammead-assets/src/svgs/coreIcons.jsx on lines 43..48

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 packages/utilities/psammead-styles/src/font-styles.js and 6 other locations - About 1 hr to fix
packages/utilities/psammead-styles/src/font-styles.js on lines 26..32
packages/utilities/psammead-styles/src/font-styles.js on lines 42..48
packages/utilities/psammead-styles/src/font-styles.js on lines 50..56
packages/utilities/psammead-styles/src/font-styles.js on lines 58..64
packages/utilities/psammead-styles/src/font-styles.js on lines 66..72
packages/utilities/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 packages/utilities/psammead-styles/src/font-styles.js and 6 other locations - About 1 hr to fix
packages/utilities/psammead-styles/src/font-styles.js on lines 34..40
packages/utilities/psammead-styles/src/font-styles.js on lines 42..48
packages/utilities/psammead-styles/src/font-styles.js on lines 50..56
packages/utilities/psammead-styles/src/font-styles.js on lines 58..64
packages/utilities/psammead-styles/src/font-styles.js on lines 66..72
packages/utilities/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

Function inputs has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const inputs = () => {
  // capitalization is only for presentation purpose on the knob
  const options = Object.keys(svgs)
    .filter(key => key !== 'BBC_BLOCKS')
    .map(key => key.charAt(0).toUpperCase() + key.slice(1));
Severity: Minor
Found in packages/components/psammead-navigation/src/index.stories.jsx - About 1 hr to fix

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

      if (!AmpElement)
        return (
          <SkipLinkWrapper service={service} provider={provider} {...skipLink}>
            <Notice service={service} provider={provider} {...fallback} />
          </SkipLinkWrapper>
    Severity: Major
    Found in packages/components/psammead-social-embed/src/index.jsx and 1 other location - About 1 hr to fix
    packages/components/psammead-social-embed/src/index.jsx on lines 27..32

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

    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

      if (!isSupportedProvider || !oEmbed)
        return (
          <SkipLinkWrapper service={service} provider={provider} {...skipLink}>
            <Notice service={service} provider={provider} {...fallback} />
          </SkipLinkWrapper>
    Severity: Major
    Found in packages/components/psammead-social-embed/src/index.jsx and 1 other location - About 1 hr to fix
    packages/components/psammead-social-embed/src/index.jsx on lines 74..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 57.

    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

    Function ordinal has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      ordinal: function (number) {
        var b = number % 10,
          output =
            ~~((number % 100) / 10) === 1
              ? 'th'
    Severity: Minor
    Found in packages/utilities/psammead-locales/moment/pcm.js - 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 getBrand has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const getBrand = () => {
      const {
        productInput,
        serviceLocalisedNameInput,
        svgHeightInput,
    Severity: Minor
    Found in packages/components/psammead-navigation/src/index.stories.jsx - About 1 hr to fix

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

        portuguese: {
          text: 'Como dormir melhor (e em menos tempo)',
          longText:
            'Medidas anunciadas no encontro entre Bolsonaro e Trump celebram aproximação com o governo americano - mas elas agora precisam passar pelo teste da concretização',
          script: 'latinDiacritics',
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 7..19
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 20..32
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 33..45
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 60..72
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 73..85
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 86..98
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 99..111
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 112..124
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 125..137
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 138..150
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 151..163
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 164..176
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 177..190
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 191..203
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 204..216
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 217..229
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 230..242
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 243..255
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 256..268
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 269..281
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 282..294
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 308..320
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 351..363
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 377..389
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 390..402
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 433..445
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 446..459
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 473..485
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 486..499
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 500..513
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 514..526
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 527..539
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 540..552
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 583..596
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 611..624
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 625..637
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 638..650

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

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

        ukrainian: {
          text:
            'Троє американців помилково відсиділи 36 років. Тепер їх визнали невинними',
          longText:
            "Альфред Честнат, Ендр Стюарт і Ренсом Воткінс потрапили за ґрати ще у 1984 році. З'ясувалося, вони ні в чому не винні, ні в чому не винні",
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 7..19
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 20..32
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 33..45
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 60..72
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 73..85
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 86..98
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 99..111
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 112..124
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 125..137
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 138..150
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 151..163
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 164..176
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 177..190
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 191..203
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 204..216
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 217..229
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 230..242
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 243..255
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 256..268
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 269..281
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 282..294
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 308..320
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 351..363
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 364..376
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 377..389
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 390..402
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 433..445
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 446..459
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 473..485
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 486..499
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 500..513
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 514..526
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 527..539
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 540..552
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 611..624
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 625..637
      packages/utilities/psammead-storybook-helpers/src/text-variants.js on lines 638..650

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

      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