Showing 2,206 of 2,206 total issues

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

  describe.each(a)('format %s', (formatString, expectedDate) => {
    const b = moment(new Date(2010, 1, 14, 15, 25, 50, 125));
    assert.equal(
      b.format(formatString),
      expectedDate,
src/app/legacy/psammead/psammead-locales/moment/mr.test.js on lines 67..74
src/app/legacy/psammead/psammead-locales/moment/pt-br.test.js on lines 64..71
src/app/legacy/psammead/psammead-locales/moment/sr-cyrl.test.js on lines 65..72
src/app/legacy/psammead/psammead-locales/moment/sr.test.js on lines 65..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 78.

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

test.each(a)('format %s', (formatString, expectedDate) => {
  const b = moment(new Date(2010, 1, 14, 15, 25, 50, 125));
  assert.equal(
    b.format(formatString),
    expectedDate,
src/app/legacy/psammead/psammead-locales/moment/mr.test.js on lines 67..74
src/app/legacy/psammead/psammead-locales/moment/sr-cyrl.test.js on lines 65..72
src/app/legacy/psammead/psammead-locales/moment/sr.test.js on lines 65..72
src/app/legacy/psammead/psammead-locales/moment/zh-tw.test.js on lines 69..76

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

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

test.each(a)('format %s', (formatString, expectedDate) => {
  const b = moment(new Date(2010, 1, 14, 15, 25, 50, 125));
  assert.equal(
    b.format(formatString),
    expectedDate,
Severity: Major
Found in src/app/legacy/psammead/psammead-locales/moment/mr.test.js and 4 other locations - About 2 hrs to fix
src/app/legacy/psammead/psammead-locales/moment/pt-br.test.js on lines 64..71
src/app/legacy/psammead/psammead-locales/moment/sr-cyrl.test.js on lines 65..72
src/app/legacy/psammead/psammead-locales/moment/sr.test.js on lines 65..72
src/app/legacy/psammead/psammead-locales/moment/zh-tw.test.js on lines 69..76

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

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 baseFixturePng = {
  alt: 'Nick Triggle',
  children: null,
  copyright: 'Getty Images',
  fade: true,
src/app/legacy/containers/ImageWithPlaceholder/fixtureData.jsx on lines 31..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 78.

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 be explicitly marked "external" for screen reader users & localised', () => {
      const { container } = render(
        <InlineLinkContainer
          locator="https://www.example.com/"
          blocks={[fragmentBlock('این لینک هست')]}
Severity: Major
Found in src/app/legacy/containers/InlineLink/index.test.jsx and 1 other location - About 2 hrs to fix
src/app/legacy/containers/InlineLink/index.test.jsx on lines 45..55

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

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 baseFixture = {
  alt: 'Pauline Clayton',
  children: null,
  copyright: 'Getty Images',
  fade: true,
src/app/legacy/containers/ImageWithPlaceholder/fixtureData.jsx on lines 50..67

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

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 be explicitly marked "external" for screen reader users', () => {
      const { container } = render(
        <InlineLinkContainer
          locator="https://www.example.com/"
          blocks={[fragmentBlock('This is a link')]}
Severity: Major
Found in src/app/legacy/containers/InlineLink/index.test.jsx and 1 other location - About 2 hrs to fix
src/app/legacy/containers/InlineLink/index.test.jsx on lines 57..67

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

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

            430: function(e, t, n) {
                "use strict";
                Object.defineProperty(t, "__esModule", {
                    value: !0
                }),
Severity: Major
Found in public/vendor/cwr.js - About 2 hrs to fix

    Function useOptimizelyScrollDepth has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const useOptimizelyScrollDepth = () => {
      const { isAmp } = useContext(RequestContext);
      const { optimizely } = useContext(OptimizelyContext);
      const [scrollDepth, setScrollDepth] = useState(0);
      const [scrollTwentyFive, setScrollTwentyFive] = useState(false);
    Severity: Major
    Found in src/app/hooks/useOptimizelyScrollDepth/index.jsx - About 2 hrs to fix

      File index.tsx has 255 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /** @jsx jsx */
      /* @jsxFrag React.Fragment */
      
      import { jsx } from '@emotion/react';
      import React, { useContext, useEffect, useRef, useState } from 'react';
      Severity: Minor
      Found in src/app/components/MediaLoader/index.tsx - About 2 hrs to fix

        Function listItems has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const listItems = files.map((fileData: FileData, index: number) => {
            const { file } = fileData;
            const key = `${index}-${file.name}`;
            const thumbnailSrc = thumbnailState[index];
            const isThumbnailSvg = thumbnailSrc?.startsWith('data:image/svg');

          Function webpackFinal has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            webpackFinal: async (config, options) => {
              const babelOptions = await options.presets.apply('babel', {}, options);
              const typescriptOptions = await options.presets.apply(
                'typescript',
                {},
          Severity: Major
          Found in .storybook/main.ts - About 2 hrs to fix

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

            export const tvBulletinItem = {
              name: 'Test TV Bulletin promo',
              summary: 'Test TV summary',
              indexImage: {
                path: '/cpsdevpb/4917/test/_63711781_clinton.jpg',
            Severity: Major
            Found in src/app/legacy/containers/Bulletin/fixtureData.js and 1 other location - About 2 hrs to fix
            src/app/legacy/containers/Bulletin/fixtureData.js on lines 23..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 77.

            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 render video indicator correctly when inline', () => {
                const { container } = render(
                  <MediaIndicator
                    dir="ltr"
                    item={videoItem}
            src/app/legacy/containers/StoryPromo/MediaIndicator/index.test.jsx on lines 154..165

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

            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 render video indicator correctly when inline on RTL', () => {
                const { container } = render(
                  <MediaIndicator
                    dir="rtl"
                    item={videoItem}
            src/app/legacy/containers/StoryPromo/MediaIndicator/index.test.jsx on lines 141..152

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

            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 render audio correctly', () => {
                const { container } = render(
                  <BulletinComponent
                    script={latin}
                    service="news"
            Severity: Major
            Found in src/app/legacy/psammead/psammead-bulletin/src/index.test.jsx and 1 other location - About 2 hrs to fix
            src/app/legacy/psammead/psammead-bulletin/src/index.test.jsx on lines 94..105

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

            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 render video correctly', () => {
                const { container } = render(
                  <BulletinComponent
                    script={latin}
                    service="news"
            Severity: Major
            Found in src/app/legacy/psammead/psammead-bulletin/src/index.test.jsx and 1 other location - About 2 hrs to fix
            src/app/legacy/psammead/psammead-bulletin/src/index.test.jsx on lines 66..77

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

            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 radioBulletinItem = {
              name: 'Test Radio Bulletin promo',
              summary: 'Test Radio summary',
              indexImage: {
                path: '/cpsdevpb/4917/test/_63711781_clinton.jpg',
            Severity: Major
            Found in src/app/legacy/containers/Bulletin/fixtureData.js and 1 other location - About 2 hrs to fix
            src/app/legacy/containers/Bulletin/fixtureData.js on lines 1..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 77.

            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 fetchPageData has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            const fetchPageData = async ({
              path,
              timeout,
              shouldLogFetchTime = !onClient(),
              agent,
            Severity: Minor
            Found in src/app/routes/utils/fetchPageData/index.js - About 2 hrs 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 exports has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = ({
              resolvePath,
              IS_PROD,
              START_DEV_SERVER,
              IS_PROD_PROFILE,
            Severity: Minor
            Found in webpack.config.client.js - About 2 hrs 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

            Severity
            Category
            Status
            Source
            Language