Showing 390 of 2,206 total issues

Function Promo has 94 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Promo = () => {
  const { podcastPromo, script, service, dir } = useContext(ServiceContext);
  const { pageType, isLite } = useContext(RequestContext);

  const {
Severity: Major
Found in src/app/legacy/containers/PodcastPromo/Inline.jsx - About 3 hrs to fix

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

    import loggerMock from '#testHelpers/loggerMock'; // Must be imported before fetchPageData
    import {
      DATA_FETCH_ERROR,
      DATA_REQUEST_RECEIVED,
      DATA_RESPONSE_FROM_CACHE,
    Severity: Minor
    Found in src/app/routes/utils/fetchPageData/index.test.js - About 3 hrs to fix

      Function FormContextProvider has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

      export const FormContextProvider = ({
        initialScreen = 'form',
        fields,
        children,
      }: PropsWithChildren<{ initialScreen?: FormScreen; fields: Field[] }>) => {
      Severity: Minor
      Found in ws-nextjs-app/pages/[service]/send/[id]/FormContext/index.tsx - 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 cookie.amp.jsx has 319 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React from 'react';
      import { Helmet } from 'react-helmet';
      import styled from '@emotion/styled';
      import {
        getDoublePica,
      Severity: Minor
      Found in src/app/legacy/containers/ConsentBanner/Banner/cookie.amp.jsx - About 3 hrs to fix

        Function extractBundlesForPageType has 91 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          extractBundlesForPageType: pageType => {
            if (pageType === 'ArticlePage') {
              return [
                'modern.ArticlePage-31ecd969.31473c35.js',
                'modern.commons-1111.js',
        Severity: Major
        Found in scripts/bundleSize/__mocks__/pageTypeBundleExtractor.js - About 3 hrs to fix

          Function getServerSideProps has 89 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const getServerSideProps: GetServerSideProps = async context => {
            context.res.setHeader(
              'Cache-Control',
              'public, stale-if-error=300, stale-while-revalidate=120, max-age=30',
            );
          Severity: Major
          Found in ws-nextjs-app/pages/[service]/live/[id]/[[...variant]].page.tsx - About 3 hrs to fix

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

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

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

              import React from 'react';
              import {
                isNull,
                suppressPropWarnings,
              } from '#psammead/psammead-test-helpers/src';
              Severity: Minor
              Found in src/app/legacy/containers/ArticleTimestamp/index.test.jsx - About 3 hrs to fix

                Function L has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            L = function(e, t) {
                                var n,
                                    r,
                                    o,
                                    i,
                Severity: Major
                Found in public/vendor/cwr.js - About 3 hrs to fix

                  Function kn has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              kn = function(e, t) {
                                  var n,
                                      r,
                                      o,
                                      i,
                  Severity: Major
                  Found in public/vendor/cwr.js - About 3 hrs to fix

                    Function s has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                s = function(e, t) {
                                    var n,
                                        r,
                                        o,
                                        i,
                    Severity: Major
                    Found in public/vendor/cwr.js - About 3 hrs to fix

                      Function O has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                  O = function(e, t) {
                                      var n,
                                          r,
                                          o,
                                          i,
                      Severity: Major
                      Found in public/vendor/cwr.js - About 3 hrs to fix

                        Function e has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                        function e() {
                                            var e = this;
                                            this.eventListener = function() {
                                                0 === performance.getEntriesByType(Ct).length ? e.performanceNavigationEventHandlerTimingLevel1() : new PerformanceObserver((function(t) {
                                                    t.getEntries().forEach((function(t) {
                        Severity: Major
                        Found in public/vendor/cwr.js - About 3 hrs to fix

                          Function lt has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                      }, lt = function(e, t) {
                                          var n,
                                              r,
                                              o,
                                              i,
                          Severity: Major
                          Found in public/vendor/cwr.js - About 3 hrs to fix

                            Function bt has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                        }, bt = function(e, t) {
                                            var n,
                                                r,
                                                o,
                                                i,
                            Severity: Major
                            Found in public/vendor/cwr.js - About 3 hrs to fix

                              Function C has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                          C = function(e, t) {
                                              var n,
                                                  r,
                                                  o,
                                                  i,
                              Severity: Major
                              Found in public/vendor/cwr.js - About 3 hrs to fix

                                Function Se has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        function Se(e, t) {
                                            var n,
                                                r,
                                                o,
                                                i,
                                Severity: Major
                                Found in public/vendor/cwr.js - About 3 hrs to fix

                                  Function d has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                                  function d(e, t) {
                                                      var n,
                                                          r,
                                                          o,
                                                          i,
                                  Severity: Major
                                  Found in public/vendor/cwr.js - About 3 hrs to fix

                                    Function jn has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                                jn = function(e, t) {
                                                    var n,
                                                        r,
                                                        o,
                                                        i,
                                    Severity: Major
                                    Found in public/vendor/cwr.js - About 3 hrs to fix

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

                                      import React from 'react';
                                      import { render } from '../../../../components/react-testing-library-with-providers';
                                      import Grid from '.';
                                      import { ExampleParagraph, ExampleFigure, ExampleImage } from './testHelpers';
                                      
                                      
                                      Severity: Minor
                                      Found in src/app/legacy/psammead/psammead-grid/src/index.test.jsx - About 3 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language