Showing 390 of 2,206 total issues

File fixtures.ts has 357 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { PromoProps } from './types';

export const promoProps = {
  children:
    'Además de sus decenas de museos tradicionales, Ciudad de México es una galería al aire libre de arte callejero, en la que exponen artistas nacionales y extranjeros. Lo invitamos a un recorrido.',
Severity: Minor
Found in src/app/components/FrostedGlassPromo/fixtures.ts - About 4 hrs to fix

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

    import React from 'react';
    import { RequestContextProvider } from '#contexts/RequestContext';
    import { ToggleContextProvider } from '#contexts/ToggleContext';
    import * as clickTracking from '#hooks/useClickTrackerHandler';
    import * as viewTracking from '#hooks/useViewTracker';

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

      import React from 'react';
      import assocPath from 'ramda/src/assocPath';
      import pashtoPageData from '#data/pashto/bbc_pashto_radio/w3ct0lz1.json';
      import koreanPageData from '#data/korean/bbc_korean_radio/w3ct0kn5.json';
      import zhongwenPageData from '#data/zhongwen/bbc_cantonese_radio/w172xf3r5x8hw4v.json';
      Severity: Minor
      Found in src/app/pages/OnDemandAudioPage/index.test.tsx - About 4 hrs to fix

        File dataStructures.js has 351 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import {
          DesktopBigPromo,
          BigPromo,
          VerticalPromo,
          TallPromo,
        Severity: Minor
        Found in src/app/components/Curation/HierarchicalGrid/dataStructures.js - About 4 hrs to fix

          Function Tt has 110 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      }(), Ct = "navigation", xt = "load", Tt = function() {
                          function e() {
                              var e = this;
                              this.eventListener = function() {
                                  0 === performance.getEntriesByType(Ct).length ? e.performanceNavigationEventHandlerTimingLevel1() : new PerformanceObserver((function(t) {
          Severity: Major
          Found in public/vendor/cwr.js - About 4 hrs to fix

            Function _n has 107 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    var _n = function() {
                            function e(e, t, n, r) {
                                void 0 === r && (r = {}),
                                void 0 === n && (n = "us-west-2");
                                var o = An(An({}, {
            Severity: Major
            Found in public/vendor/cwr.js - About 4 hrs to fix

              Function testsThatNeverRunDuringSmokeTestingForCanonicalOnly has 107 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const testsThatNeverRunDuringSmokeTestingForCanonicalOnly = () => {
                // TODO: Re-enable these and check for consent banner
                describe.skip('Social Embed', () => {
                  // This test specifically covers an edge case where more than one tweet is
                  // included in a Story and twitter needs to be prompted to render the tweet
              Severity: Major
              Found in cypress/e2e/pages/storyPage/testsForCanonicalOnly.js - About 4 hrs to fix

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

                import React from 'react';
                import { storiesOf } from '@storybook/react';
                import styled from '@emotion/styled';
                import {
                  color,
                Severity: Minor
                Found in src/app/legacy/psammead/psammead-navigation/src/index.stories.jsx - About 4 hrs to fix

                  Function Image has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const Image = ({
                    alt,
                    aspectRatio,
                    attribution,
                    className,
                  Severity: Minor
                  Found in src/app/components/Image/index.tsx - About 4 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 test has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          it('should be displayed if the toggle is on, and shows the expected number of items', function test() {
                            let toggleName;
                  
                            if (Cypress.env('currentPath').includes('podcasts')) {
                              toggleName = 'recentPodcastEpisodes';
                  Severity: Major
                  Found in cypress/e2e/pages/onDemandAudio/tests.js - About 4 hrs to fix

                    File directives.js has 343 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { bbcDomains, advertisingServiceCountryDomains } from './domainLists';
                    
                    const advertisingDirectives = {
                      frameSrc: [
                        'https://*.doubleclick.net',
                    Severity: Minor
                    Found in src/server/utilities/cspHeader/directives.js - About 4 hrs to fix

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

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

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

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

                          Function Cn has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

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

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

                            import {
                              videoBlock,
                              rawVideoBlock,
                              blockContainingText,
                              blockBase,
                            Severity: Minor
                            Found in src/app/models/blocks/index.test.js - About 4 hrs to fix

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

                              import React from 'react';
                              import {
                                act,
                                fireEvent,
                                render,
                              Severity: Minor
                              Found in ws-nextjs-app/pages/[service]/send/[id]/FormField/File/index.test.tsx - About 4 hrs to fix

                                Function collectResults has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                                Open

                                const collectResults = async (link, service, type) => {
                                  await fetchWithCert(link).then(response => {
                                    if (response.ok) {
                                      response.json().then(json => {
                                        const jsondata = 'data' in json ? json.data : json;
                                Severity: Minor
                                Found in scripts/mostReadCollectionTimes.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

                                Function collectResults has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                                Open

                                const collectResults = async (link, service, type) => {
                                  await fetchWithCert(link).then(response => {
                                    if (response.ok) {
                                      response.json().then(json => {
                                        const jsondata = 'data' in json ? json.data : json;
                                Severity: Minor
                                Found in scripts/mostReadAndWatchedCollectionData.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

                                Function Xt has 97 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                            }, Xt = function() {
                                                function e() {
                                                    this.pluginId = "com.amazonaws.rum.web-vitals"
                                                }
                                                return e.prototype.load = function(e) {
                                Severity: Major
                                Found in public/vendor/cwr.js - About 3 hrs to fix

                                  Function useClickTrackerHandler has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const useClickTrackerHandler = (props = {}) => {
                                    const preventNavigation = path(['preventNavigation'], props);
                                    const componentName = path(['componentName'], props);
                                    const url = path(['url'], props);
                                    const advertiserID = path(['advertiserID'], props);
                                  Severity: Major
                                  Found in src/app/hooks/useClickTrackerHandler/index.jsx - About 3 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language