Showing 2,206 of 2,206 total issues

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

    describe('episode has availability: pending', () => {
      expect(testAvailability('pending')).toEqual('not-yet-available');
      expect(loggerMock.info).toHaveBeenCalledWith(EPISODE_NOT_YET_AVAILABLE, {
        url: 'pashto/bbc_pashto_radio/w3ct0lz1',
        availability: 'pending',
Severity: Major
Found in src/app/lib/utilities/episodeAvailability/index.test.js and 3 other locations - About 1 hr to fix
src/app/lib/utilities/episodeAvailability/index.test.js on lines 53..59
src/app/lib/utilities/episodeAvailability/index.test.js on lines 69..75
src/app/lib/utilities/episodeAvailability/index.test.js on lines 77..86

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

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

    describe('episode has availability: junk-value', () => {
      expect(testAvailability('junk-value')).toEqual('expired');
      expect(loggerMock.error).toHaveBeenCalledWith(
        UNRECOGNISED_EPISODE_AVAILABILITY,
        {
Severity: Major
Found in src/app/lib/utilities/episodeAvailability/index.test.js and 3 other locations - About 1 hr to fix
src/app/lib/utilities/episodeAvailability/index.test.js on lines 53..59
src/app/lib/utilities/episodeAvailability/index.test.js on lines 61..67
src/app/lib/utilities/episodeAvailability/index.test.js on lines 69..75

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

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

    describe('episode has availability: future', () => {
      expect(testAvailability('future')).toEqual('not-yet-available');
      expect(loggerMock.info).toHaveBeenCalledWith(EPISODE_NOT_YET_AVAILABLE, {
        url: 'pashto/bbc_pashto_radio/w3ct0lz1',
        availability: 'future',
Severity: Major
Found in src/app/lib/utilities/episodeAvailability/index.test.js and 3 other locations - About 1 hr to fix
src/app/lib/utilities/episodeAvailability/index.test.js on lines 53..59
src/app/lib/utilities/episodeAvailability/index.test.js on lines 61..67
src/app/lib/utilities/episodeAvailability/index.test.js on lines 77..86

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

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 output a nav bar for media asset pages', () => {
      HeaderContainerWithContext({
        renderOptions: {
          pageType: MEDIA_ASSET_PAGE,
        },
Severity: Major
Found in src/app/legacy/containers/Header/index.test.jsx and 1 other location - About 1 hr to fix
src/app/legacy/containers/Header/index.test.jsx on lines 96..103

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

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 output a nav bar for articles', () => {
      HeaderContainerWithContext({
        renderOptions: {
          pageType: ARTICLE_PAGE,
        },
Severity: Major
Found in src/app/legacy/containers/Header/index.test.jsx and 1 other location - About 1 hr to fix
src/app/legacy/containers/Header/index.test.jsx on lines 87..94

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

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 not have a tab index when id is not "content"', () => {
    const { container } = render(<Component idAttr="foo" />);

    expect(container.querySelector('[tabIndex]')).toBeNull();
  });
Severity: Major
Found in src/app/legacy/containers/OnDemandHeading/index.test.jsx and 1 other location - About 1 hr to fix
src/app/legacy/containers/OnDemandHeading/index.test.jsx on lines 64..68

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

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 call the view tracking hook with the correct params', () => {
    const viewTrackerSpy = jest.spyOn(viewTracking, 'default');
    render(<PromoWithContext />);

    expect(viewTrackerSpy).toHaveBeenCalledWith({
Severity: Major
Found in src/app/legacy/containers/PodcastPromo/index.test.jsx and 1 other location - About 1 hr to fix
src/app/legacy/containers/PodcastPromo/index.test.jsx on lines 230..237

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

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.prototype.disable = function() {
                    this.enabled && (this.enabled = !1, this.resourceEventListener && window.removeEventListener(_t, this.resourceEventListener))
                }, e.prototype.getPluginId = function() {
Severity: Major
Found in public/vendor/cwr.js and 1 other location - About 1 hr to fix
public/vendor/cwr.js on lines 3863..3865

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

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

  it('should return 404 status', () => {
    const service = 'portuguese';
    const result = shouldRender(
      invalidPortugueseData,
      service,
src/app/legacy/containers/PageHandlers/withData/shouldRender/index.test.js on lines 94..107
src/app/legacy/containers/PageHandlers/withData/shouldRender/index.test.js on lines 109..122

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

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

  it('should match passport home override', () => {
    const service = 'portuguese';
    const result = shouldRender(
      validPortugueseData,
      service,
src/app/legacy/containers/PageHandlers/withData/shouldRender/index.test.js on lines 109..122
src/app/legacy/containers/PageHandlers/withData/shouldRender/index.test.js on lines 193..206

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

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 call the click tracking hook with the correct params', () => {
    const clickTrackerSpy = jest.spyOn(clickTracking, 'default');
    render(<PromoWithContext />);

    expect(clickTrackerSpy).toHaveBeenCalledWith({
Severity: Major
Found in src/app/legacy/containers/PodcastPromo/index.test.jsx and 1 other location - About 1 hr to fix
src/app/legacy/containers/PodcastPromo/index.test.jsx on lines 221..228

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

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 have a tab index of -1 when id is "content"', () => {
    const { container } = render(<Component idAttr="content" />);

    expect(container.querySelector('[tabIndex=-1]')).toBeInTheDocument();
  });
Severity: Major
Found in src/app/legacy/containers/OnDemandHeading/index.test.jsx and 1 other location - About 1 hr to fix
src/app/legacy/containers/OnDemandHeading/index.test.jsx on lines 70..74

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

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

  it('should NOT match passport home override', () => {
    const service = 'portuguese';
    const result = shouldRender(
      validPortugueseData,
      service,
src/app/legacy/containers/PageHandlers/withData/shouldRender/index.test.js on lines 94..107
src/app/legacy/containers/PageHandlers/withData/shouldRender/index.test.js on lines 193..206

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

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.prototype.disable = function() {
                    this.enabled && (this.enabled = !1, this.eventListener && window.removeEventListener(xt, this.eventListener))
                }, e.prototype.hasTheWindowLoadEventFired = function() {
Severity: Major
Found in public/vendor/cwr.js and 1 other location - About 1 hr to fix
public/vendor/cwr.js on lines 3937..3939

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

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

                    this.performanceNavigationEventHandlerTimingLevel1 = function() {
                        setTimeout((function() {
                            var t = performance.timing,
                                n = t.navigationStart,
                                r = {
Severity: Minor
Found in public/vendor/cwr.js - About 1 hr to fix

    Function w has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                    function w(e, t, n) {
                        if (!Symbol.asyncIterator)
                            throw new TypeError("Symbol.asyncIterator is not defined.");
                        var r,
                            o = n.apply(e, t || []),
    Severity: Minor
    Found in public/vendor/cwr.js - About 1 hr to fix

      Function signString has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Function rowsTest has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const rowsTest = value => {
          describe('first section', () => {
            it(`should correctly split ${value} stories`, () => {
              const items = numberOfStories[value].input;
              const isFirstSection = true;

          Function allowedItemsTest has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const allowedItemsTest = value => {
            describe('first section', () => {
              it(`should return correct allowed items for ${value} stories`, () => {
                const items = numberOfStories[value].input;
                const isFirstSection = true;

            Function AdvertTagLoader has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const AdvertTagLoader = () => {
              const location = useLocation();
              const queryString = location ? location.search : '';
            
              useEffect(() => {
            Severity: Minor
            Found in src/app/components/MediaLoader/index.tsx - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language