Showing 2,206 of 2,206 total issues

Function generateLaunchDates has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

const generateLaunchDates = service => {
  const output = [];
  const serviceLaunch = launchDates[service];

  if (serviceLaunch) {
Severity: Minor
Found in scripts/releaseInfo/index.js - About 3 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

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

/* eslint-disable global-require */
import {
  renderHook,
  act,
} from '#app/components/react-testing-library-with-providers';

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

    import React from 'react';
    import { suppressPropWarnings } from '#psammead/psammead-test-helpers/src';
    import fixture from '../../../../data/pidgin/topics/c95y35941vrt.json';
    import mundoFixture from '../../../../data/mundo/topics/c1en6xwmpkvt.json';
    import kyrgyzHomePage from '../../../../data/kyrgyz/homePage/index.json';
    Severity: Minor
    Found in src/app/components/Curation/index.test.tsx - About 3 hrs to fix

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

          it('should return true when the time difference between firstPublished and lastPublished in minutes is greater than the minutes tolerance', () => {
            const currentTime = mockedDate();
            const twoMinutesAgo = timestampGenerator({
              minutes: 2,
            });
      src/app/legacy/containers/ArticleTimestamp/shouldDisplayLastUpdatedTimestamp.test.jsx on lines 34..43

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

      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 a YouTube block and unmount correctly', () => {
            const { container, unmount } = render(
              <SocialEmbedContainer
                blocks={[youtubeBlockEmbed]}
                source="https://www.youtube.com/embed/1e05_rwHvOM?feature=oembed"
      Severity: Major
      Found in src/app/legacy/containers/SocialEmbed/index.test.jsx and 1 other location - About 3 hrs to fix
      src/app/legacy/containers/SocialEmbed/index.test.jsx on lines 93..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 96.

      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

          describe('should render headline with bold & italic text', () => {
            const data = {
              blocks: blocksSingleFragment('All is bold and italic', [
                'bold',
                'italic',
      Severity: Major
      Found in src/app/legacy/containers/Headings/index.test.jsx and 1 other location - About 3 hrs to fix
      src/app/legacy/containers/Headings/index.test.jsx on lines 188..203

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

      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 the time difference between firstPublished and lastPublished in minutes is less than the minutes tolerance', () => {
            const currentTime = mockedDate();
            const fortyEightSecondsAgo = timestampGenerator({ minutes: 0.8 });
            const msDifference = currentTime - fortyEightSecondsAgo;
            const timeDifferenceMinutes = msDifference / 1000 / 60;
      src/app/legacy/containers/ArticleTimestamp/shouldDisplayLastUpdatedTimestamp.test.jsx on lines 21..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 96.

      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 ContextWrap = ({ pageType, isAmp, children, service }) => (
        <RequestContextProvider
          isAmp={isAmp}
          pageType={pageType}
          service={service}
      src/app/legacy/containers/OptimizelyArticleCompleteTracking/index.test.jsx on lines 60..71

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

      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 a TikTok block and unmount correctly', () => {
            const { container, unmount } = render(
              <SocialEmbedContainer
                blocks={[tiktokBlockEmbed]}
                source="https://www.tiktok.com/@cuppymusic/video/7086167423639997701"
      Severity: Major
      Found in src/app/legacy/containers/SocialEmbed/index.test.jsx and 1 other location - About 3 hrs to fix
      src/app/legacy/containers/SocialEmbed/index.test.jsx on lines 79..91

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

      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

          describe('should render headline with italic & bold text', () => {
            const data = {
              blocks: blocksSingleFragment('All is italic and bold', [
                'italic',
                'bold',
      Severity: Major
      Found in src/app/legacy/containers/Headings/index.test.jsx and 1 other location - About 3 hrs to fix
      src/app/legacy/containers/Headings/index.test.jsx on lines 171..186

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

      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 ContextWrap = ({ pageType, isAmp, children, service }) => (
        <RequestContextProvider
          isAmp={isAmp}
          pageType={pageType}
          service={service}
      src/app/legacy/containers/OptimizelyPageViewTracking/index.test.jsx on lines 19..30

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

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

                  a = function(e) {
                      var t = this;
                      this.getId = function(e) {
                          return i(t, void 0, void 0, (function() {
                              var t,
      Severity: Major
      Found in public/vendor/cwr.js - About 3 hrs to fix

        Function t has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                        function t(t) {
                            var n = e.call(this) || this;
                            return n.isTracingEnabled = function() {
                                return n.context.config.enableXRay
                            }, n.isSessionRecorded = function() {
        Severity: Major
        Found in public/vendor/cwr.js - About 3 hrs to fix

          File fixture.ts has 292 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import {
            CpsRecommendation,
            OptimoRecommendation,
          } from '../../../../models/types/onwardJourney';
          
          

            Function handleSubmit has 75 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const handleSubmit = async (event: FormEvent) => {
                event.preventDefault();
                setAttemptedSubmitCount(prevCount => prevCount + 1);
                // Reset error state
                setSubmissionError(null);
            Severity: Major
            Found in ws-nextjs-app/pages/[service]/send/[id]/FormContext/index.tsx - About 3 hrs to fix

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

                              if (expectedNumberOfEpisodes > 1) {
                                cy.get('[data-e2e=recent-episodes-list]').should('exist');
              
                                cy.get('[data-e2e=recent-episodes-list]').within(() => {
                                  cy.get('[data-e2e=recent-episodes-list-item]')
              Severity: Major
              Found in cypress/e2e/pages/onDemandTV/tests.js and 1 other location - About 3 hrs to fix
              cypress/e2e/pages/onDemandAudio/tests.js on lines 132..163

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

              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

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

                                if (expectedNumberOfEpisodes > 1) {
                                  cy.get('[data-e2e=recent-episodes-list]').should('exist');
              
                                  cy.get('[data-e2e=recent-episodes-list]').within(() => {
                                    cy.get('[data-e2e=recent-episodes-list-item]')
              Severity: Major
              Found in cypress/e2e/pages/onDemandAudio/tests.js and 1 other location - About 3 hrs to fix
              cypress/e2e/pages/onDemandTV/tests.js on lines 87..113

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

              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

                  describe('headline with italic text', () => {
                    const data = {
                      blocks: blocksSingleFragment('All is italic', ['italic']),
                      type: 'headline',
                    };
              Severity: Major
              Found in src/app/legacy/containers/Headings/index.test.jsx and 1 other location - About 3 hrs to fix
              src/app/legacy/containers/Headings/index.test.jsx on lines 157..169

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

              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 default () => {
                describe('Amp Iframe', () => {
                  const ampIframe = document.querySelector(
                    `amp-iframe[src*="https://news.test.files.bbci.co.uk/include/newsspec/36430-optimo-deployments/nhs-tracker/pidgin/app/amp?version=1.0.202310241621"]`,
                  );
              Severity: Major
              Found in src/integration/common/ampIframe.amp.js and 1 other location - About 3 hrs to fix
              src/integration/common/embedHtml.amp.js on lines 1..15

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

              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

                  describe('headline with bold text', () => {
                    const data = {
                      blocks: blocksSingleFragment('All is bold', ['bold']),
                      type: 'headline',
                    };
              Severity: Major
              Found in src/app/legacy/containers/Headings/index.test.jsx and 1 other location - About 3 hrs to fix
              src/app/legacy/containers/Headings/index.test.jsx on lines 143..155

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

              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