Showing 2,206 of 2,206 total issues

File fixture.ts has 487 lines of code (exceeds 250 allowed). Consider refactoring.
Open

export const aresMediaCaptionBlock = {
  id: '31318aec',
  type: 'caption',
  model: {
    blocks: [
Severity: Minor
Found in src/app/components/MediaLoader/fixture.ts - About 7 hrs to fix

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

    stories.add('Jalaali Pashto', () => {
      testMoment.locale('ps');
      const jalaaliMomentDate = jalaali.formatDate(testMoment);
      const gregorianMomentDate = testMoment.format('DD YYYY MMMM');
      testMoment.locale('en');
    src/app/legacy/psammead/psammead-calendars/src/calendars.stories.jsx on lines 9..31

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

    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

    stories.add('Jalaali Persian', () => {
      testMoment.locale('fa');
      const jalaaliMomentDate = jalaali.formatDate(testMoment);
      const gregorianMomentDate = testMoment.format('DD YYYY MMMM');
      testMoment.locale('en');
    src/app/legacy/psammead/psammead-calendars/src/calendars.stories.jsx on lines 33..55

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

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

    const launchDates = {
      afaanoromoo: {
        articles: 'Sept 2019',
        frontPage: '5th Feb 2020',
        liveRadio: '30th Sept 2019',
    Severity: Minor
    Found in scripts/releaseInfo/launchDates.js - About 7 hrs to fix

      File theming.ts has 482 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      export interface BrandPalette {
        BRAND_BACKGROUND: string;
        BRAND_LOGO: string;
        BRAND_FOREGROUND: string;
        BRAND_HIGHLIGHT: string;
      Severity: Minor
      Found in src/app/models/types/theming.ts - About 7 hrs to fix

        File text-variants.ts has 481 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { Services, Variants } from '#app/models/types/global';
        
        type TextVariant = {
          text: string;
          longText: string;
        Severity: Minor
        Found in .storybook/withServicesDecorator/text-variants.ts - About 7 hrs to fix

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

              describe('Relative time 59 minutes ago', () => {
                it('should render timestamp in string format', () => {
                  const fiftyNineMinutesAgoString =
                    calcTimestampMinutesAgo(59).toISOString();
                  const { getByText } = render(
          Severity: Major
          Found in src/app/legacy/components/Promo/index.test.jsx and 1 other location - About 7 hrs to fix
          src/app/legacy/components/Promo/index.test.jsx on lines 243..264

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

          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('Relative time 9 hours ago', () => {
                it('should render timestamp in string format', () => {
                  const nineHoursAgoString = calcTimestampHoursAgo(9).toISOString();
                  const { getByText } = render(
                    <Fixture timestamp={nineHoursAgoString} />,
          Severity: Major
          Found in src/app/legacy/components/Promo/index.test.jsx and 1 other location - About 7 hrs to fix
          src/app/legacy/components/Promo/index.test.jsx on lines 220..242

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

          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('for hash params params', () => {
              it.each`
                campaignType          | href                                                                                                                                                                                          | expectedValue
                ${'affiliate'}        | ${'https://www.bbc.com/mundo#at_medium=affiliate&at_campaign=73&at_creation=wsmundo&at_format=Link&at_identifier=whatsapp&at_type=partner&at_variant=Editorial'}                              | ${'al-73-[partner]-[whatsapp]-[Link]-[wsmundo]-[Editorial]'}
                ${'sl'}               | ${'https://www.bbc.com/mundo#at_medium=sl&at_term=article&at_network=search&at_creation=my_adgroup&at_variant=Editorial&at_platform=google&at_campaign=73'}                                   | ${'SEC-73-[google]-[my_adgroup]-[Editorial]-F=S-[article]'}
          Severity: Major
          Found in src/app/lib/analyticsUtils/index.test.js and 1 other location - About 7 hrs to fix
          src/app/lib/analyticsUtils/index.test.js on lines 796..816

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

          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

                              }, n.handleXhrAbortEvent = function(e) {
                                  var t = e.target,
                                      r = n.xhrMap.get(t),
                                      o = "XMLHttpRequest abort";
                                  if (r) {
          Severity: Major
          Found in public/vendor/cwr.js and 1 other location - About 7 hrs to fix
          public/vendor/cwr.js on lines 4355..4372

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

          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

                              }, n.handleXhrTimeoutEvent = function(e) {
                                  var t = e.target,
                                      r = n.xhrMap.get(t),
                                      o = "XMLHttpRequest timeout";
                                  if (r) {
          Severity: Major
          Found in public/vendor/cwr.js and 1 other location - About 7 hrs to fix
          public/vendor/cwr.js on lines 4338..4355

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

          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('for query params', () => {
              it.each`
                campaignType          | href                                                                                                                                                                                         | expectedValue
                ${'affiliate'}        | ${'https://www.bbc.com/mundo?at_medium=affiliate&at_campaign=73&at_creation=wsmundo&at_format=Link&at_identifier=whatsapp&at_type=partner&at_variant=Editorial'}                             | ${'al-73-[partner]-[whatsapp]-[Link]-[wsmundo]-[Editorial]'}
                ${'sl'}               | ${'https://www.bbc.com/mundo?at_medium=sl&at_term=article&at_network=search&at_creation=my_adgroup&at_variant=Editorial&at_platform=google&at_campaign=73'}                                  | ${'SEC-73-[google]-[my_adgroup]-[Editorial]-F=S-[article]'}
          Severity: Major
          Found in src/app/lib/analyticsUtils/index.test.js and 1 other location - About 7 hrs to fix
          src/app/lib/analyticsUtils/index.test.js on lines 817..837

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

          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 constructPageFetchUrl has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
          Open

          const constructPageFetchUrl = ({
            pathname,
            pageType,
            service,
            variant,
          Severity: Minor
          Found in src/app/routes/utils/constructPageFetchUrl/index.ts - About 7 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 index.test.jsx has 471 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React from 'react';
          import { render, cleanup } from '@testing-library/react';
          import deepClone from 'ramda/src/clone';
          import loggerMock from '#testHelpers/loggerMock';
          import { MEDIA_MISSING } from '#lib/logger.const';
          Severity: Minor
          Found in src/app/legacy/containers/StoryPromo/index.test.jsx - About 7 hrs to fix

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

            test('weeks year starting friday', () => {
              assert.equal(
                moment([2009, 11, 27]).week(),
                1,
                'Dec 27 2009 should be week 1'
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 447..458
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 460..471
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 473..484
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 486..497
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 467..478
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 480..491
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 493..504
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 506..517
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 519..530

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

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

            test('weeks year starting monday', () => {
              assert.equal(
                moment([2006, 11, 31]).week(),
                1,
                'Dec 31 2006 should be week 1'
            Severity: Major
            Found in src/app/legacy/psammead/psammead-locales/moment/ta.test.js and 9 other locations - About 7 hrs to fix
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 447..458
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 460..471
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 473..484
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 486..497
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 499..510
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 480..491
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 493..504
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 506..517
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 519..530

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

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

            test('weeks year starting thursday', () => {
              assert.equal(
                moment([2008, 11, 28]).week(),
                1,
                'Dec 28 2008 should be week 1'
            Severity: Major
            Found in src/app/legacy/psammead/psammead-locales/moment/ta.test.js and 9 other locations - About 7 hrs to fix
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 447..458
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 460..471
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 473..484
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 486..497
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 499..510
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 467..478
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 480..491
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 493..504
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 519..530

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

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

            test('weeks year starting friday', () => {
              assert.equal(
                moment([2009, 11, 27]).week(),
                1,
                'Dec 27 2009 should be week 1'
            Severity: Major
            Found in src/app/legacy/psammead/psammead-locales/moment/ta.test.js and 9 other locations - About 7 hrs to fix
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 447..458
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 460..471
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 473..484
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 486..497
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 499..510
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 467..478
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 480..491
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 493..504
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 506..517

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

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

            test('weeks year starting monday', () => {
              assert.equal(
                moment([2006, 11, 31]).week(),
                1,
                'Dec 31 2006 should be week 1'
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 460..471
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 473..484
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 486..497
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 499..510
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 467..478
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 480..491
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 493..504
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 506..517
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 519..530

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

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

            test('weeks year starting tuesday', () => {
              assert.equal(
                moment([2007, 11, 29]).week(),
                52,
                'Dec 29 2007 should be week 52'
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 447..458
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 473..484
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 486..497
            src/app/legacy/psammead/psammead-locales/moment/pa-in.test.js on lines 499..510
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 467..478
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 480..491
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 493..504
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 506..517
            src/app/legacy/psammead/psammead-locales/moment/ta.test.js on lines 519..530

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

            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