MailOnline/videojs-vast-vpaid

View on GitHub

Showing 331 of 331 total issues

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

  function assertError(callback, msg, code) {
    var error = testUtils.firstArg(callback);
    assert.instanceOf(error, VASTError);
    assert.equal(error.message, "VAST Error: " + msg);
    if (code) {
Severity: Major
Found in test/ads/vast/VASTClient.spec.js and 1 other location - About 2 hrs to fix
test/ads/vast/VASTIntegrator.spec.js on lines 22..29

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

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("must add the clickTrackings to the response", function () {
        var videoClicksXML = '<VideoClicks>' +
          '<ClickTracking><![CDATA[ http://www.tracking1.com ]]></ClickTracking>' +
          '<ClickTracking><![CDATA[ http://www.tracking2.com ]]></ClickTracking>' +
          '</VideoClicks>';
Severity: Major
Found in test/ads/vast/VASTResponse.spec.js and 1 other location - About 2 hrs to fix
test/ads/vast/VASTResponse.spec.js on lines 362..375

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

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("must add the customClicks to the response", function () {
        var videoClicksXML = '<VideoClicks>' +
          '<CustomClick><![CDATA[ http://www.tracking1.com ]]></CustomClick>' +
          '<CustomClick><![CDATA[ http://www.tracking2.com ]]></CustomClick>' +
          '</VideoClicks>';
Severity: Major
Found in test/ads/vast/VASTResponse.spec.js and 1 other location - About 2 hrs to fix
test/ads/vast/VASTResponse.spec.js on lines 347..360

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

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("must return preferred tech if supported and available", function () {
        var settings = {preferredTech: 'html5'};
        var vastResponse = new VASTResponse();
        vastResponse._addMediaFiles([createMediaFile('http://fakeVideoFile', FLASH_APP_MIME), createMediaFile('http://anotherFakeVideoFile', JS_APP_MIME)]);
        assert.instanceOf(vpaidIntegrator._findSupportedTech(vastResponse, settings), VPAIDHTML5Tech);
Severity: Major
Found in test/ads/vpaid/VPAIDIntegrator.spec.js and 1 other location - About 2 hrs to fix
test/ads/vpaid/VPAIDIntegrator.spec.js on lines 889..894

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

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("must return preferred tech if supported and available", function () {
        var settings = {preferredTech: 'flash'};
        var vastResponse = new VASTResponse();
        vastResponse._addMediaFiles([createMediaFile('http://fakeVideoFile', FLASH_APP_MIME), createMediaFile('http://anotherFakeVideoFile', JS_APP_MIME)]);
        assert.instanceOf(vpaidIntegrator._findSupportedTech(vastResponse, settings), VPAIDFlashTech);
Severity: Major
Found in test/ads/vpaid/VPAIDIntegrator.spec.js and 1 other location - About 2 hrs to fix
test/ads/vpaid/VPAIDIntegrator.spec.js on lines 882..887

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

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

function Linear(linearJTree) {
  if (!(this instanceof Linear)) {
    return new Linear(linearJTree);
  }

Severity: Minor
Found in src/scripts/ads/vast/Linear.js - About 2 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

Function setupEvents has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

VASTIntegrator.prototype._setupEvents = function setupEvents(adMediaFile, tracker, response, callback) {
  var previouslyMuted;
  var player = this.player;
  player.on('fullscreenchange', trackFullscreenChange);
  player.on('vast.adStart', trackImpressions);
Severity: Major
Found in src/scripts/ads/vast/VASTIntegrator.js - About 2 hrs to fix

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

        it("must be added to the linear", function () {
          var encodedAdParameters = xml.encode('<some>data</some>');
    
          var linearXML = '<Linear skipoffset="10%"><AdParameters><![CDATA[' + encodedAdParameters + ']]></AdParameters></Linear>';
          var linear = new Linear(xml.toJXONTree(linearXML));
    Severity: Major
    Found in test/ads/vast/Linear.spec.js and 1 other location - About 2 hrs to fix
    test/ads/vast/Linear.spec.js on lines 170..176

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

    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

    VPAIDAdUnitWrapper.prototype.on = function (evtName, handler) {
      var addEventListener = this._adUnit.addEventListener || this._adUnit.subscribe || this._adUnit.on;
      addEventListener.call(this._adUnit, evtName, handler);
    };
    Severity: Major
    Found in src/scripts/ads/vpaid/VPAIDAdUnitWrapper.js and 1 other location - About 2 hrs to fix
    src/scripts/ads/vpaid/VPAIDAdUnitWrapper.js on lines 102..105

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

    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

    VPAIDAdUnitWrapper.prototype.off = function (evtName, handler) {
      var removeEventListener = this._adUnit.removeEventListener || this._adUnit.unsubscribe || this._adUnit.off;
      removeEventListener.call(this._adUnit, evtName, handler);
    };
    Severity: Major
    Found in src/scripts/ads/vpaid/VPAIDAdUnitWrapper.js and 1 other location - About 2 hrs to fix
    src/scripts/ads/vpaid/VPAIDAdUnitWrapper.js on lines 97..100

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

    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("with xmlEncoded to false, must NOT decode the ad params before adding them to the linear", function () {
          var encodedAdParameters = xml.encode('<some>data</some>');
    
          var linearXML = '<Linear skipoffset="10%"><AdParameters xmlEncoded="false"><![CDATA[' + encodedAdParameters + ']]></AdParameters></Linear>';
          var linear = new Linear(xml.toJXONTree(linearXML));
    Severity: Major
    Found in test/ads/vast/Linear.spec.js and 1 other location - About 2 hrs to fix
    test/ads/vast/Linear.spec.js on lines 154..160

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

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

    /*jshint unused:false */
    "use strict";
    
    var NODE_TYPE_ELEMENT = 1;
    var SNAKE_CASE_REGEXP = /[A-Z]/g;
    Severity: Minor
    Found in src/scripts/utils/utilityFunctions.js - About 2 hrs to fix

      Function Companion has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function Companion(companionJTree) {
        if (!(this instanceof Companion)) {
          return new Companion(companionJTree);
        }
      
      
      Severity: Major
      Found in src/scripts/ads/vast/Companion.js - About 2 hrs to fix

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

          if (xml.keyValue(companionJTree.IFrameResource)) {
            iframeResource = xml.keyValue(companionJTree.IFrameResource);
          } else if (xml.keyValue(companionJTree.iFrameresource)) {
            iframeResource = xml.keyValue(companionJTree.iFrameresource);
          }
        Severity: Major
        Found in src/scripts/ads/vast/Companion.js and 1 other location - About 2 hrs to fix
        src/scripts/ads/vast/Companion.js on lines 29..33

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

        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("must be able to resume the adUnit", function(){
                  var adUnit = vastIntegrator.playAd(new VASTResponse(), utilities.noop);
                  sinon.spy(player, 'play');
                  adUnit.resumeAd();
                  sinon.assert.calledOnce(player.play);
        Severity: Major
        Found in test/ads/vast/VASTIntegrator.spec.js and 1 other location - About 2 hrs to fix
        test/ads/vast/VASTIntegrator.spec.js on lines 145..150

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

        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("must be able to pause the adUnit", function(){
                  var adUnit = vastIntegrator.playAd(new VASTResponse(), utilities.noop);
                  sinon.spy(player, 'pause');
                  adUnit.pauseAd();
                  sinon.assert.calledOnce(player.pause);
        Severity: Major
        Found in test/ads/vast/VASTIntegrator.spec.js and 1 other location - About 2 hrs to fix
        test/ads/vast/VASTIntegrator.spec.js on lines 152..157

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

        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

          if (xml.keyValue(companionJTree.HTMLResource)) {
            htmlResource = xml.keyValue(companionJTree.HTMLResource);
          } else if (xml.keyValue(companionJTree.hTMLResource)) {
            htmlResource = xml.keyValue(companionJTree.hTMLResource);
          }
        Severity: Major
        Found in src/scripts/ads/vast/Companion.js and 1 other location - About 2 hrs to fix
        src/scripts/ads/vast/Companion.js on lines 43..47

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

        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

              it("must not be triggered if there is an vast.firstPlay after restoring the content", function(){
                player.trigger('vast.firstPlay');
                player.trigger('playing');
                player.trigger('ended');
                sinon.assert.notCalled(contentStartSpy);
        Severity: Major
        Found in test/plugin/videojs.vast.spec.js and 3 other locations - About 2 hrs to fix
        test/plugin/videojs.vast.spec.js on lines 368..374
        test/plugin/videojs.vast.spec.js on lines 384..390
        test/plugin/videojs.vast.spec.js on lines 392..398

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

        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

              it("must not trigger vast.contentEnd if there is a vast.reset after restoring the content", function(){
                player.trigger('playing');
                player.trigger('vast.reset');
                player.trigger('ended');
                sinon.assert.calledOnce(contentStartSpy);
        Severity: Major
        Found in test/plugin/videojs.vast.spec.js and 3 other locations - About 2 hrs to fix
        test/plugin/videojs.vast.spec.js on lines 368..374
        test/plugin/videojs.vast.spec.js on lines 376..382
        test/plugin/videojs.vast.spec.js on lines 392..398

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

        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

              it("must not trigger vast.contentEnd if there is a vast.firstPlay after restoring the content", function(){
                player.trigger('playing');
                player.trigger('vast.firstPlay');
                player.trigger('ended');
                sinon.assert.calledOnce(contentStartSpy);
        Severity: Major
        Found in test/plugin/videojs.vast.spec.js and 3 other locations - About 2 hrs to fix
        test/plugin/videojs.vast.spec.js on lines 368..374
        test/plugin/videojs.vast.spec.js on lines 376..382
        test/plugin/videojs.vast.spec.js on lines 384..390

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

        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