Showing 2,206 of 2,206 total issues

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

  describe('null passportHomeOverride', () => {
    it('should NOT match passport home override', () => {
      const service = 'portuguese';
      const result = shouldRender(
        validPortugueseData,
src/app/legacy/containers/PageHandlers/withData/shouldRender/index.test.js on lines 158..173

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

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.skip('should serve a file for valid service paths with variants', async () => {
      const { body } = await makeRequest(
        '/zhongwen/uk-23283128/recommendations/trad.json',
      );
      expect(body).toEqual(
Severity: Major
Found in src/server/index.test.jsx and 1 other location - About 1 hr to fix
src/server/index.test.jsx on lines 961..972

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

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('null override', () => {
      it('should NOT match', () => {
        const service = 'portuguese';
        const result = shouldRender(
          noPassport,
src/app/legacy/containers/PageHandlers/withData/shouldRender/index.test.js on lines 140..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 74.

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 serve a file for valid service paths without variants', async () => {
      const { body } = await makeRequest(
        '/mundo/23263889/recommendations.json',
      );
      expect(body).toEqual(
Severity: Major
Found in src/server/index.test.jsx and 1 other location - About 1 hr to fix
src/server/index.test.jsx on lines 949..960

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

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

                        A = function(e, t) {
                            if ("object" == typeof e && (t = e, e = i), !(this instanceof A))
                                return new A(e, t).getResult();
                            var n = e || (void 0 !== o && o.navigator && o.navigator.userAgent ? o.navigator.userAgent : ""),
                                r = t ? E.extend(T, t) : T;
Severity: Minor
Found in public/vendor/cwr.js - About 1 hr to fix

    Function collectResults has 48 lines of code (exceeds 25 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 1 hr to fix

      Function LiteSiteCta has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const LiteSiteCta = () => {
        const { dir, translations } = useContext(ServiceContext);
        const { canonicalLink } = useContext(RequestContext);
        const isRtl = dir === 'rtl';
        const { liteSite = defaultTranslations } = translations;
      Severity: Minor
      Found in src/app/components/LiteSiteCta/index.tsx - About 1 hr to fix

        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

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

          try {
            const { status, json } = await fetchDataFromBFF({
              pathname,
              service,
              variant,
        Severity: Major
        Found in src/app/routes/mostRead/getInitialData/index.js and 2 other locations - About 1 hr to fix
        src/app/routes/frontPage/getInitialData/index.js on lines 36..78
        src/app/routes/topic/getInitialData/index.js on lines 24..65

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

        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 3 locations. Consider refactoring.
        Open

          try {
            const pageDataPromise = fetchDataFromBFF({
              pathname,
              pageType: CPS_ASSET, // Legacy Front Pages are curated in CPS and fetched from the BFF using pageType = CPS_ASSET and id = service/front_page
              service,
        Severity: Major
        Found in src/app/routes/frontPage/getInitialData/index.js and 2 other locations - About 1 hr to fix
        src/app/routes/mostRead/getInitialData/index.js on lines 17..45
        src/app/routes/topic/getInitialData/index.js on lines 24..65

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

        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 3 locations. Consider refactoring.
        Open

          try {
            const { status, json } = await fetchDataFromBFF({
              pathname: overrideRendererEnv(pathname),
              service,
              variant,
        Severity: Major
        Found in src/app/routes/topic/getInitialData/index.js and 2 other locations - About 1 hr to fix
        src/app/routes/frontPage/getInitialData/index.js on lines 36..78
        src/app/routes/mostRead/getInitialData/index.js on lines 17..45

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

        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

          describe(`testsForCanonicalOnly for ${service} ${pageType} ${variant}`, () => {
            describe('Chartbeat', () => {
              if (envConfig.chartbeatEnabled) {
                it('should have a script with src value set to chartbeat source', () => {
                  cy.hasScriptWithChartbeatSrc();
        Severity: Major
        Found in cypress/e2e/pages/mostReadPage/testsForCanonicalOnly.js and 1 other location - About 1 hr to fix
        cypress/e2e/pages/articles/testsForCanonicalOnly.js on lines 17..28

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

        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 (appToggles.chartbeatAnalytics.enabled) {
              describe('Chartbeat', () => {
                if (envConfig.chartbeatEnabled) {
                  it('should have a script with src value set to chartbeat source', () => {
                    cy.hasScriptWithChartbeatSrc();
        Severity: Major
        Found in cypress/e2e/pages/articles/testsForCanonicalOnly.js and 1 other location - About 1 hr to fix
        cypress/e2e/pages/mostReadPage/testsForCanonicalOnly.js on lines 4..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 73.

        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 serve a file for valid service paths without variants', async () => {
              const { body } = await makeRequest('/pidgin/mostread.json');
              expect(body.data).toEqual(
                expect.objectContaining({ items: expect.any(Object) }),
              );
        Severity: Major
        Found in src/server/index.test.jsx and 1 other location - About 1 hr to fix
        src/server/index.test.jsx on lines 900..905

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

        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

                            this.dispatchBeaconFailSilent = function() {
                                return wt(o, void 0, void 0, (function() {
                                    return bt(this, (function(e) {
                                        return [2, this.dispatchBeacon().catch((function() {}))]
                                    }))
        Severity: Major
        Found in public/vendor/cwr.js and 1 other location - About 1 hr to fix
        public/vendor/cwr.js on lines 3692..3698

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

        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

                            this.dispatchFetchFailSilent = function() {
                                return wt(o, void 0, void 0, (function() {
                                    return bt(this, (function(e) {
                                        return [2, this.dispatchFetch().catch((function() {}))]
                                    }))
        Severity: Major
        Found in public/vendor/cwr.js and 1 other location - About 1 hr to fix
        public/vendor/cwr.js on lines 3699..3705

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

        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

                <Grid
                  dir={dir}
                  item
                  columns={{
                    group0: 6,
        Severity: Major
        Found in src/app/legacy/psammead/psammead-grid/src/index.stories.jsx and 1 other location - About 1 hr to fix
        src/app/legacy/psammead/psammead-grid/src/index.stories.jsx on lines 59..76

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

        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 serve a file for valid service paths with variants', async () => {
              const { body } = await makeRequest('/zhongwen/mostread/trad.json');
              expect(body.data).toEqual(
                expect.objectContaining({ items: expect.any(Object) }),
              );
        Severity: Major
        Found in src/server/index.test.jsx and 1 other location - About 1 hr to fix
        src/server/index.test.jsx on lines 906..911

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

        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