Showing 2,206 of 2,206 total issues

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

import React from 'react';
import { JSDOM } from 'jsdom';

import {
  render,
Severity: Minor
Found in src/app/components/Image/index.test.tsx - About 5 hrs to fix

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

    import range from 'ramda/src/range';
    import {
      getAllowedItems,
      removeFirstSlotRadioBulletin,
      removeTVBulletinsIfNotAVLiveStream,

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

      import moment from 'moment';
      import './si';
      
      moment.locale('si');
      
      
      Severity: Minor
      Found in src/app/legacy/psammead/psammead-locales/moment/si.test.js - About 5 hrs to fix

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

            it('should route to and render a 500 error page', async () => {
              const pathname = '/igbo/500';
              const { getInitialData, pageType } = getMatchingRoute(pathname);
              const { errorCode } = await getInitialData({
                path: pathname,
        Severity: Major
        Found in src/app/routes/index.test.jsx and 1 other location - About 5 hrs to fix
        src/app/routes/index.test.jsx on lines 389..408

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

        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 route to and render a 404 error page', async () => {
              const pathname = '/igbo/404';
              const { getInitialData, pageType } = getMatchingRoute(pathname);
              const { errorCode } = await getInitialData({
                path: pathname,
        Severity: Major
        Found in src/app/routes/index.test.jsx and 1 other location - About 5 hrs to fix
        src/app/routes/index.test.jsx on lines 341..361

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

        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 live.test.tsx has 380 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React from 'react';
        import { Helmet } from 'react-helmet';
        
        import {
          render,
        Severity: Minor
        Found in ws-nextjs-app/pages/[service]/live/[id]/live.test.tsx - About 5 hrs to fix

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

              it('sets PRIVACY_COOKIE and returns showPrivacyBanner=TRUE when PRIVACY_COOKIE is 0', () => {
                Cookies.set(PRIVACY_COOKIE, '0');
                cookieSetterSpy.mockClear();
                const { result } = renderHook(() => useConsentBanners());
          
          
          src/app/legacy/containers/ConsentBanner/useConsentBanners/index.test.js on lines 82..99

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 137.

          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('sets PRIVACY_COOKIE and returns showPrivacyBanner=TRUE when PRIVACY_COOKIE is 1', () => {
                Cookies.set(PRIVACY_COOKIE, '1');
                cookieSetterSpy.mockClear();
                const { result } = renderHook(() => useConsentBanners());
          
          
          src/app/legacy/containers/ConsentBanner/useConsentBanners/index.test.js on lines 63..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 137.

          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.tsx has 377 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React from 'react';
          import { BrowserRouter } from 'react-router-dom';
          import { RequestContextProvider } from '#contexts/RequestContext';
          import { ToggleContext } from '#contexts/ToggleContext';
          import { FRONT_PAGE } from '#app/routes/utils/pageTypes';
          Severity: Minor
          Found in src/app/components/Ad/index.test.tsx - About 5 hrs to fix

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

                    var we = function() {
                        return we = Object.assign || function(e) {
                            for (var t, n = 1, r = arguments.length; n < r; n++)
                                for (var o in t = arguments[n])
                                    Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
            Severity: Major
            Found in public/vendor/cwr.js and 2 other locations - About 4 hrs to fix
            public/vendor/cwr.js on lines 430..437
            public/vendor/cwr.js on lines 1014..1021

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

            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

                            var i = function() {
                                return i = Object.assign || function(e) {
                                    for (var t, n = 1, r = arguments.length; n < r; n++)
                                        for (var o in t = arguments[n])
                                            Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
            Severity: Major
            Found in public/vendor/cwr.js and 2 other locations - About 4 hrs to fix
            public/vendor/cwr.js on lines 1014..1021
            public/vendor/cwr.js on lines 2487..2494

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

            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

                    var t = function() {
                        return t = Object.assign || function(e) {
                            for (var t, n = 1, r = arguments.length; n < r; n++)
                                for (var o in t = arguments[n])
                                    Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
            Severity: Major
            Found in public/vendor/cwr.js and 2 other locations - About 4 hrs to fix
            public/vendor/cwr.js on lines 430..437
            public/vendor/cwr.js on lines 2487..2494

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

            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 th.test.js has 372 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import moment from 'moment';
            import './th';
            
            moment.locale('th');
            
            
            Severity: Minor
            Found in src/app/legacy/psammead/psammead-locales/moment/th.test.js - About 4 hrs to fix

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

              import moment from 'moment';
              import './ur';
              
              moment.locale('ur');
              
              
              Severity: Minor
              Found in src/app/legacy/psammead/psammead-locales/moment/ur.test.js - About 4 hrs to fix

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

                  describe('Legacy Assets', () => {
                    it('should construct correct data file path', () => {
                      expect(
                        constructDataFilePath({
                          pageType: 'legacyAssets',
                Severity: Major
                Found in src/server/local/constructDataFilePath/index.test.js and 2 other locations - About 4 hrs to fix
                src/server/local/constructDataFilePath/index.test.js on lines 88..109
                src/server/local/constructDataFilePath/index.test.js on lines 136..157

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

                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

                  describe('Articles', () => {
                    it('should construct correct data file path', () => {
                      expect(
                        constructDataFilePath({
                          pageType: 'articles',
                Severity: Major
                Found in src/server/local/constructDataFilePath/index.test.js and 2 other locations - About 4 hrs to fix
                src/server/local/constructDataFilePath/index.test.js on lines 88..109
                src/server/local/constructDataFilePath/index.test.js on lines 111..134

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

                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

                  describe('CPS Assets', () => {
                    it('should construct correct data file path', () => {
                      expect(
                        constructDataFilePath({
                          pageType: 'cpsAssets',
                Severity: Major
                Found in src/server/local/constructDataFilePath/index.test.js and 2 other locations - About 4 hrs to fix
                src/server/local/constructDataFilePath/index.test.js on lines 111..134
                src/server/local/constructDataFilePath/index.test.js on lines 136..157

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

                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

                const IntersectionObserver = jest.fn(cb => {
                  const item = {
                    callback: cb,
                    elements: new Set(),
                  };
                src/app/hooks/useViewTracker/index.test.jsx on lines 23..41

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

                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

                const IntersectionObserver = jest.fn(cb => {
                  const item = {
                    callback: cb,
                    elements: new Set(),
                  };
                Severity: Major
                Found in src/app/hooks/useViewTracker/index.test.jsx and 1 other location - About 4 hrs to fix
                src/app/legacy/containers/OptimizelyArticleCompleteTracking/index.test.jsx on lines 22..40

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

                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('isLive', () => {
                  it('should return true when SIMORGH_APP_ENV is live', () => {
                    process.env.SIMORGH_APP_ENV = 'live';
                    expect(isLive()).toBe(true);
                  });
                Severity: Major
                Found in src/app/lib/utilities/isLive/index.test.js and 1 other location - About 4 hrs to fix
                src/app/lib/utilities/isTest/index.test.js on lines 3..17

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

                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