Showing 2,206 of 2,206 total issues

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

  it.each`
    bundleType
    ${'modern'}
    ${'legacy'}
  `('includes crossOrigin attribute - $bundleType bundle', ({ bundleType }) => {
Severity: Major
Found in src/server/utilities/attributeFunctions/index.test.js and 1 other location - About 2 hrs to fix
src/server/utilities/attributeFunctions/index.test.js on lines 57..72

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

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 render RTL correctly', () => {
    const { container } = render(<StartTime timestamp={testUnixTimestamp} />, {
      dir: 'rtl',
      locale: 'fa',
      service: 'persian',
src/app/legacy/components/RadioSchedule/StartTime/index.test.jsx on lines 10..18

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

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 correctly render a single topic tag for persian', () => {
    const { container } = render(
      <TopicTags service="persian" script={arabicTypography}>
        <TopicTag name="test1" link="#" />
      </TopicTags>,
src/app/legacy/psammead/psammead-topic-tags/src/index.test.jsx on lines 35..42

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

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 render timestamp in ISO string format', () => {
        const overTenHoursString = calcTimestampHoursAgo(10).toISOString();
        const { getByText } = render(
          <Fixture timestamp={overTenHoursString} />,
          {
Severity: Major
Found in src/app/legacy/components/Promo/index.test.jsx and 1 other location - About 2 hrs to fix
src/app/legacy/components/Promo/index.test.jsx on lines 279..288

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

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 correctly render a single topic tag for burmese', () => {
    const { container } = render(
      <TopicTags service="burmese" script={burmeseTypography}>
        <TopicTag name="test1" link="#" />
      </TopicTags>,
src/app/legacy/psammead/psammead-topic-tags/src/index.test.jsx on lines 44..51

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

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('Embed', () => {
    it('should render if there is a curation with embed data', () => {
      const { getByTestId } = render(
        <TopicPage pageData={persianAfghanistan} />,
        getOptionParams({ service: 'persian' }),
Severity: Major
Found in src/app/pages/TopicPage/index.test.jsx and 1 other location - About 2 hrs to fix
src/app/pages/TopicPage/index.test.jsx on lines 334..343

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

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 render timestamp in epoch format', () => {
        const overTenHoursEpoch = calcTimestampHoursAgo(10).getTime();
        const { getByText } = render(
          <Fixture timestamp={overTenHoursEpoch} />,
          {
Severity: Major
Found in src/app/legacy/components/Promo/index.test.jsx and 1 other location - About 2 hrs to fix
src/app/legacy/components/Promo/index.test.jsx on lines 269..278

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

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 show the correct local date', () => {
      const { getByText } = render(
        <WrappedArticleTimestamp {...props} service="news" />,
      );
      const timeEl = getByText(/9 August 2019/);
Severity: Major
Found in src/app/legacy/containers/ArticleTimestamp/index.test.jsx and 1 other location - About 2 hrs to fix
src/app/legacy/containers/ArticleTimestamp/index.test.jsx on lines 364..371

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

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 show the correct local date for Bengali', () => {
      const { getByText } = render(
        <WrappedArticleTimestamp {...props} service="bengali" />,
      );
      const timeEl = getByText(/১০ অগাস্ট ২০১৯/);
Severity: Major
Found in src/app/legacy/containers/ArticleTimestamp/index.test.jsx and 1 other location - About 2 hrs to fix
src/app/legacy/containers/ArticleTimestamp/index.test.jsx on lines 354..362

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

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

        quantize: function (h, c) {
          if (!h.length || c < 2 || c > 256) return !1;
          var f = (function (t) {
            var o,
              i = new Array(1 << (3 * r));
Severity: Major
Found in src/app/hooks/useImageColour/colorthief.js - About 2 hrs to fix

    Function pt has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                }, pt = function(e) {
                    var t = this;
                    this.sendFetch = function(e) {
                        return ut(t, void 0, void 0, (function() {
                            var t,
    Severity: Major
    Found in public/vendor/cwr.js - About 2 hrs to fix

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

                              for (void 0 !== s && s.length > 0 && s.forEach((function(e) {
                                  var o = st(e.name);
                                  t.config.recordAllTypes.includes(o) ? n.push(e) : t.config.sampleTypes.includes(o) && r.push(e)
                              })), it(n); n.length > 0 && o < t.config.eventLimit;)
      Severity: Major
      Found in public/vendor/cwr.js and 1 other location - About 2 hrs to fix
      public/vendor/cwr.js on lines 3893..3898

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

      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.ChainAnonymousCredentialsProvider = function() {
                              return k(t, void 0, void 0, (function() {
                                  return L(this, (function(e) {
                                      return [2, this.AnonymousCredentialsProvider().catch(this.AnonymousStorageCredentialsProvider).catch(this.AnonymousCognitoCredentialsProvider)]
                                  }))
      Severity: Major
      Found in public/vendor/cwr.js and 1 other location - About 2 hrs to fix
      public/vendor/cwr.js on lines 1736..1742

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

      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.ChainAnonymousCredentialsProvider = function() {
                              return _(t, void 0, void 0, (function() {
                                  return O(this, (function(e) {
                                      return [2, this.AnonymousCredentialsProvider().catch(this.AnonymousStorageCredentialsProvider).catch(this.AnonymousCognitoCredentialsProvider)]
                                  }))
      Severity: Major
      Found in public/vendor/cwr.js and 1 other location - About 2 hrs to fix
      public/vendor/cwr.js on lines 1934..1940

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

      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

                                      e.getEntries().filter((function(e) {
                                          return e.entryType === It
                                      })).forEach((function(e) {
                                          var o = st(e.name);
                                          t.config.recordAllTypes.includes(o) ? n.push(e) : t.config.sampleTypes.includes(o) && r.push(e)
      Severity: Major
      Found in public/vendor/cwr.js and 1 other location - About 2 hrs to fix
      public/vendor/cwr.js on lines 3904..3907

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

      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(`Tests for ${pageType} page - ${currentPath}`, () => {
            before(() => {
              Cypress.env('currentPath', currentPath);
              visitPage(currentPath, pageType);
            });
      Severity: Major
      Found in cypress/e2e/pages/homePage/index.cy.js and 1 other location - About 2 hrs to fix
      cypress/e2e/pages/mostReadPage/index.cy.js on lines 29..44

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

      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(`${pageType} - ${envs.baseUrl}${currentPath}`, () => {
                before(() => {
                  Cypress.env('currentPath', currentPath);
                  visitPage(currentPath, pageType);
                });
      Severity: Major
      Found in cypress/e2e/pages/mostReadPage/index.cy.js and 1 other location - About 2 hrs to fix
      cypress/e2e/pages/homePage/index.cy.js on lines 18..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 84.

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

          function s(r, n) {
            if (n.count()) {
              var o = n.r2 - n.r1 + 1,
                i = n.g2 - n.g1 + 1,
                u = t.max([o, i, n.b2 - n.b1 + 1]);
      Severity: Major
      Found in src/app/hooks/useImageColour/colorthief.js - About 2 hrs to fix

        Function signRequest has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                        }, e.prototype.signRequest = function(e, t) {
                            var n = void 0 === t ? {} : t,
                                r = n.signingDate,
                                o = void 0 === r ? new Date : r,
                                i = n.signableHeaders,
        Severity: Major
        Found in public/vendor/cwr.js - About 2 hrs to fix

          Function getPageBundleData has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const getPageBundleData = () => {
            const main = getBundlesData(
              jsFiles.filter(fileName => fileName.startsWith(`${bundleType}.main-`)),
            );
            const framework = getBundlesData(
          Severity: Major
          Found in scripts/bundleSize/getBundleData.js - About 2 hrs to fix
            Severity
            Category
            Status
            Source
            Language