bbc/psammead

View on GitHub

Showing 201 of 201 total issues

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

const japanese = {
  group: (
    <g
      fillRule="evenodd"
      stroke="#000"
Severity: Major
Found in packages/utilities/psammead-assets/src/svgs/japanese.jsx and 2 other locations - About 5 hrs to fix
packages/utilities/psammead-assets/src/svgs/korean.jsx on lines 5..25
packages/utilities/psammead-assets/src/svgs/zhongwen.jsx on lines 5..25

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

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

const korean = {
  group: (
    <g
      fillRule="evenodd"
      stroke="#000"
Severity: Major
Found in packages/utilities/psammead-assets/src/svgs/korean.jsx and 2 other locations - About 5 hrs to fix
packages/utilities/psammead-assets/src/svgs/japanese.jsx on lines 5..25
packages/utilities/psammead-assets/src/svgs/zhongwen.jsx on lines 5..25

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

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

File index.jsx has 342 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import { bool, node, number, shape, oneOf } from 'prop-types';
import styled from '@emotion/styled';
import {
  GEL_MARGIN_BELOW_400PX,
Severity: Minor
Found in packages/components/psammead-grid/src/index.jsx - About 4 hrs to fix

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

    const igboNavData = [
      {
        title: 'Home',
        url: '/pidgin',
      },
    .storybook/preview.js on lines 69..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 116.

    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

    const fontPathMap = [
      { prefix: 'F_MALLANNA', path: 'fonts/Mallanna/' },
      { prefix: 'F_NOTO_SANS_ETHIOPIC', path: 'fonts/NotoSansEthiopic/' },
      { prefix: 'F_NOTO_SANS_TAMIL', path: 'fonts/NotoSerifTamil/' },
      { prefix: 'F_NOTO_SERIF_BENGALI', path: 'fonts/NotoSerifBengali/' },
    Severity: Major
    Found in .storybook/preview.js and 1 other location - About 4 hrs to fix
    packages/components/psammead-navigation/testHelpers/pidgin.js on lines 1..38

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 116.

    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

    File index.test.jsx has 330 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* eslint-disable no-underscore-dangle */
    
    import React from 'react';
    import { render, act } from '@testing-library/react';
    import styled from '@emotion/styled';
    Severity: Minor
    Found in packages/components/psammead-content-anchor/src/index.test.jsx - About 3 hrs to fix

      File font-families.js has 313 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*
       *  BBC REITH
       */
      const reithFallback = `Helvetica, Arial, sans-serif;`;
      const reithSans = `font-family: ReithSans, ${reithFallback}`;
      Severity: Minor
      Found in packages/utilities/psammead-styles/src/font-families.js - About 3 hrs to fix

        File index.test.jsx has 307 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React from 'react';
        import { shouldMatchSnapshot } from '@bbc/psammead-test-helpers';
        import Grid from '.';
        import { ExampleParagraph, ExampleFigure, ExampleImage } from './testHelpers';
        
        
        Severity: Minor
        Found in packages/components/psammead-grid/src/index.test.jsx - About 3 hrs to fix

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

          export const Headline = styled.h1`
            ${({ script }) => script && getCanon(script)};
            ${({ service }) => getSerifMedium(service)}
            color: ${({ darkMode }) => (darkMode ? C_LUNAR : C_SHADOW)};
            display: block; /* Explicitly set */
          Severity: Major
          Found in packages/components/psammead-headings/src/index.jsx and 1 other location - About 3 hrs to fix
          packages/components/psammead-headings/src/index.jsx on lines 36..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 99.

          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 SubHeading = styled.h2`
            ${({ script }) => script && getTrafalgar(script)};
            ${({ service }) => getSansBold(service)}
            color: ${({ darkMode }) => (darkMode ? C_LUNAR : C_SHADOW)};
            margin: 0; /* Reset */
          Severity: Major
          Found in packages/components/psammead-headings/src/index.jsx and 1 other location - About 3 hrs to fix
          packages/components/psammead-headings/src/index.jsx on lines 14..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 99.

          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 snapshotTests has 78 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const snapshotTests = (Component, additionalProps) => {
            shouldMatchSnapshot(
              'should render landscape image correctly',
              <Component
                alt={landscape.alt}
          Severity: Major
          Found in packages/components/psammead-image/src/testHelpers/snapshotTests.jsx - About 3 hrs to fix

            File index.test.jsx has 295 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* eslint-disable no-console */
            import React from 'react';
            import { render, waitFor } from '@testing-library/react';
            import { shouldMatchSnapshot } from '@bbc/psammead-test-helpers';
            import { CanonicalSocialEmbed, AmpSocialEmbed } from './index';
            Severity: Minor
            Found in packages/components/psammead-social-embed/src/index.test.jsx - About 3 hrs to fix

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

              moment.updateLocale('sr', {
                longDateFormat: {
                  LL: 'D MMMM YYYY',
                  LLL: 'D MMMM YYYY H:mm',
                  LLLL: 'dddd, D MMMM YYYY H:mm',
              Severity: Major
              Found in packages/utilities/psammead-locales/moment/sr.js and 1 other location - About 2 hrs to fix
              packages/utilities/psammead-locales/moment/sr-cyrl.js on lines 4..19

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

              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

              moment.updateLocale('sr-cyrl', {
                longDateFormat: {
                  LL: 'D MMMM YYYY',
                  LLL: 'D MMMM YYYY H:mm',
                  LLLL: 'dddd, D MMMM YYYY H:mm',
              Severity: Major
              Found in packages/utilities/psammead-locales/moment/sr-cyrl.js and 1 other location - About 2 hrs to fix
              packages/utilities/psammead-locales/moment/sr.js on lines 4..19

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

              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

              File index.jsx has 285 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React from 'react';
              import styled from '@emotion/styled';
              import { shape, string, node, bool, oneOf } from 'prop-types';
              import VisuallyHiddenText from '@bbc/psammead-visually-hidden-text';
              import { C_WHITE, C_EBON } from '@bbc/psammead-styles/colours';
              Severity: Minor
              Found in packages/components/psammead-navigation/src/index.jsx - About 2 hrs to fix

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

                const YouTube = ({ id }) => (
                  <>
                    <Helmet>
                      <script
                        async
                Severity: Major
                Found in packages/components/psammead-social-embed/src/Amp/index.jsx and 1 other location - About 2 hrs to fix
                packages/components/psammead-social-embed/src/Amp/index.jsx on lines 24..35

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

                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

                File index.test.js has 275 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import fetch from 'cross-fetch';
                import * as webVitals from 'web-vitals';
                import { renderHook } from '@testing-library/react-hooks';
                import useWebVitals from './index';
                
                
                Severity: Minor
                Found in packages/utilities/web-vitals/src/index.test.js - About 2 hrs to fix

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

                  const Twitter = ({ id }) => (
                    <>
                      <Helmet>
                        <script
                          async
                  Severity: Major
                  Found in packages/components/psammead-social-embed/src/Amp/index.jsx and 1 other location - About 2 hrs to fix
                  packages/components/psammead-social-embed/src/Amp/index.jsx on lines 37..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 87.

                  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

                  File index.jsx has 267 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import React, { cloneElement, useRef } from 'react';
                  import styled from '@emotion/styled';
                  import { shape, string, bool, func, oneOf, node } from 'prop-types';
                  import VisuallyHiddenText from '@bbc/psammead-visually-hidden-text';
                  import { navigationIcons } from '@bbc/psammead-assets/svgs';

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

                      shouldMatchSnapshot(
                        'should render landscape image correctly',
                        <Component
                          alt={landscape.alt}
                          attribution={landscape.attribution}
                    packages/components/psammead-image/src/testHelpers/snapshotTests.jsx on lines 18..29
                    packages/components/psammead-image/src/testHelpers/snapshotTests.jsx on lines 30..41
                    packages/components/psammead-image/src/testHelpers/snapshotTests.jsx on lines 42..53

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

                    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