Showing 390 of 2,206 total issues

Function StoryPromoContainer has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

const StoryPromoContainer = ({
  item,
  index = 0,
  promoType = 'regular',
  lazyLoadImage = true,
Severity: Minor
Found in src/app/legacy/containers/StoryPromo/index.jsx - About 1 hr 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 getPageData has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

export const getPageData = ({ service, pageType, variant = 'default', id }) => {
  // eslint-disable-next-line no-param-reassign
  service = config[service]?.name || service;

  const env = Cypress.env('APP_ENV');
Severity: Minor
Found in cypress/support/commands/application.js - About 1 hr 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 MediaArticlePage has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

const MediaArticlePage = ({ pageData }: { pageData: Article }) => {
  const { pageType, service } = useContext(RequestContext);
  const {
    articleAuthor,
    isTrustProjectParticipant,
Severity: Minor
Found in src/app/pages/MediaArticlePage/MediaArticlePage.tsx - About 1 hr 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 testsThatAlwaysRunForCanonicalOnly has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const testsThatAlwaysRunForCanonicalOnly = () => {
  const skipOnLocal =
    Cypress.env('APP_ENV') !== 'local' ? describe : describe.skip;

  skipOnLocal(
Severity: Minor
Found in cypress/e2e/pages/storyPage/testsForCanonicalOnly.js - About 1 hr to fix

    Function decorators has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        story => {
          useEffect(() => {
            if (isChromatic()) {
              forceVisible();
            }
    Severity: Minor
    Found in .storybook/preview.tsx - About 1 hr to fix

      Function signEvent has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                      }, e.prototype.signEvent = function(e, t) {
                          var n = e.headers,
                              r = e.payload,
                              o = t.signingDate,
                              i = void 0 === o ? new Date : o,
      Severity: Minor
      Found in public/vendor/cwr.js - About 1 hr to fix

        Function getToggles has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const getToggles = async (service, cache) => {
          const environment = getEnvConfig().SIMORGH_APP_ENV || 'local';
          const timeout =
            parseInt(getEnvConfig().SIMORGH_CONFIG_TIMEOUT_SECONDS, 10) * 1000;
          const localToggles = defaultToggles[environment];
        Severity: Minor
        Found in src/app/lib/utilities/getToggles/index.js - About 1 hr to fix

          Function getAmpIframeUrl has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          export const getAmpIframeUrl = ({ id, versionID, lang }: FuncProps) => {
            if (!id) return null;
          
            const { platform, service, variant, assetId } = parseAvRoute(id);
          
          
          Severity: Minor
          Found in src/app/components/MediaLoader/utils/urlConstructors.ts - About 1 hr 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 shouldRender has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          const shouldRender = (
            { pageData, status },
            service,
            pathName,
            pageType,

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

                          function e(e) {
                              var t = this;
                              this.resourceEventListener = function(e) {
                                  var n = [],
                                      r = [],
          Severity: Minor
          Found in public/vendor/cwr.js - About 1 hr to fix

            Function getPromo has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const getPromo = podcastPromo => {
              if (!podcastPromo) {
                return {};
              }
            
            
            Severity: Minor
            Found in src/app/legacy/containers/PodcastPromo/shared.js - About 1 hr to fix

              Function generateLaunchDates has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const generateLaunchDates = service => {
                const output = [];
                const serviceLaunch = launchDates[service];
              
                if (serviceLaunch) {
              Severity: Minor
              Found in scripts/releaseInfo/index.js - About 1 hr to fix

                Function a has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                                    a = function() {
                                        function e(e) {
                                            if (this.hash = new i.RawSha256, e) {
                                                this.outer = new i.RawSha256;
                                                var t = function(e) {
                Severity: Minor
                Found in public/vendor/cwr.js - About 1 hr to fix

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

                                  function e(e, t) {
                                      var n = this;
                                      this.events = [],
                                      this.recordPageView = function(e) {
                                          n.isCurrentUrlAllowed() && n.pageManager.recordPageView(e)
                  Severity: Minor
                  Found in public/vendor/cwr.js - About 1 hr to fix

                    Function bylineBlock has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const bylineBlock = (text, id = null) => {
                      const fragment = singleFragmentBlock(`@${text}`, id);
                      const urlLink = optionalIdBlock(
                        blockBase('urlLink', {
                          text: `@${text}`,
                    Severity: Minor
                    Found in src/app/models/blocks/index.js - About 1 hr to fix

                      Function Ln has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                  Ln = function(e) {
                                      return Pn(void 0, void 0, void 0, (function() {
                                          var t,
                                              n;
                                          return kn(this, (function(r) {
                      Severity: Minor
                      Found in public/vendor/cwr.js - About 1 hr to fix

                        Function exports has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        module.exports = api => {
                          const env = api.env();
                          const useModern = env === 'modern';
                        
                          const presets = [
                        Severity: Minor
                        Found in babel.config.main.js - About 1 hr to fix

                          Function test has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  it('should be displayed if there is enough schedule data', function test() {
                                    const currentPath = `${Cypress.env(
                                      'currentPath',
                                    )}.json${overrideRendererOnTest()}`;
                          
                          
                          Severity: Minor
                          Found in cypress/e2e/pages/onDemandAudio/tests.js - About 1 hr to fix

                            Function childrenFallback has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const childrenFallback = (
                              item,
                              dir,
                              columnsGroup,
                              marginsGroup,
                            Severity: Minor
                            Found in src/app/legacy/psammead/psammead-grid/src/index.jsx - About 1 hr to fix

                              Function liveBlogUpdate has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  .map(result => {
                                    const headerBlocks = result?.header?.model?.blocks;
                                    const contentBlocks = result?.content?.model?.blocks;
                              
                                    if (!headerBlocks || !contentBlocks) return null;
                              Severity: Minor
                              Found in src/app/lib/seoUtils/getLiveBlogPostingSchema/index.ts - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language