MailOnline/videojs-vast-vpaid

View on GitHub

Showing 331 of 331 total issues

File VPAIDIntegrator.spec.js has 911 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var VPAIDAdUnitWrapper = require('ads/vpaid/VPAIDAdUnitWrapper');
var VPAIDIntegrator = require('ads/vpaid/VPAIDIntegrator');
var VPAIDFlashTech = require('ads/vpaid/VPAIDFlashTech');
var VPAIDHTML5Tech = require('ads/vpaid/VPAIDHTML5Tech');

Severity: Major
Found in test/ads/vpaid/VPAIDIntegrator.spec.js - About 2 days to fix

    File videojs.vast.spec.js has 750 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    var MediaFile = require('ads/vast/MediaFile');
    var VASTClient = require('ads/vast/VASTClient');
    var VASTError = require('ads/vast/VASTError');
    var VASTIntegrator = require('ads/vast/VASTIntegrator');
    var VASTResponse = require('ads/vast/VASTResponse');
    Severity: Major
    Found in test/plugin/videojs.vast.spec.js - About 1 day to fix

      File utilityFunctions.spec.js has 735 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      var dom = require('utils/dom');
      var utilities = require('utils/utilityFunctions');
      
      describe("utilities.noop", function () {
        it("must return undefined", function () {
      Severity: Major
      Found in test/utils/utilityFunctions.spec.js - About 1 day to fix

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

            describe("on", function(){
              it("must call the subscribe method of the inner adunit", function(){
                vpaidAdUnit.on = undefined;
                vpaidAdUnit.addEventListener = undefined;
                sinon.spy(vpaidAdUnit, 'subscribe');
        Severity: Major
        Found in test/ads/vpaid/VPAIDAdUnitWrapper.spec.js and 1 other location - About 1 day to fix
        test/ads/vpaid/VPAIDAdUnitWrapper.spec.js on lines 200..227

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

        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("off", function(){
              it("must call the unsubscribe method of the inner adunit", function(){
                vpaidAdUnit.off = undefined;
                vpaidAdUnit.removeEventListener = undefined;
                sinon.spy(vpaidAdUnit, 'unsubscribe');
        Severity: Major
        Found in test/ads/vpaid/VPAIDAdUnitWrapper.spec.js and 1 other location - About 1 day to fix
        test/ads/vpaid/VPAIDAdUnitWrapper.spec.js on lines 171..198

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

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

        var dom = require('utils/dom');
        var utilities = require('utils/utilityFunctions');
        var playerUtils = require('utils/playerUtils');
        
        var videoJsVersion = parseInt(videojs.VERSION.split('.')[0], 10);
        Severity: Major
        Found in test/utils/playerUtils.spec.js - About 1 day to fix

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

                it("must request the next ad in the waterfall if the previous ad chain returned an error", function(){
                  var adTagUrl = 'http://foo.bar/';
                  vast._getVASTAd(adTagUrl, callback);
                  this.clock.tick();
          
          
          Severity: Major
          Found in test/ads/vast/VASTClient.spec.js and 1 other location - About 1 day to fix
          test/ads/vast/VASTClient.spec.js on lines 601..623

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

          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 not pass an error to the callback if one of the adChains in the VAST waterfall returned a valid ad", function(){
                  var adTagUrl = 'http://foo.bar/';
                  vast._getVASTAd(adTagUrl, callback);
                  this.clock.tick();
          
          
          Severity: Major
          Found in test/ads/vast/VASTClient.spec.js and 1 other location - About 1 day to fix
          test/ads/vast/VASTClient.spec.js on lines 559..581

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

          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("utilities.isIPhone", function(){
            var old_UA;
          
            beforeEach(function(){
              old_UA = utilities._UA;
          Severity: Major
          Found in test/utils/utilityFunctions.spec.js and 1 other location - About 1 day to fix
          test/utils/utilityFunctions.spec.js on lines 868..893

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

          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("utilities.isAndroid", function(){
            var old_UA;
          
            beforeEach(function(){
              old_UA = utilities._UA;
          Severity: Major
          Found in test/utils/utilityFunctions.spec.js and 1 other location - About 1 day to fix
          test/utils/utilityFunctions.spec.js on lines 841..866

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

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

          'use strict';
          
          describe("VASTIntegrator", function () {
          
            var MediaFile = require('ads/vast/MediaFile');
          Severity: Major
          Found in test/ads/vast/VASTIntegrator.spec.js - About 1 day to fix

            Function VASTPlugin has 237 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function VASTPlugin(options) {
              var snapshot;
              var player = this;
              var vast = new VASTClient();
              var adsCanceled = false;
            Severity: Major
            Found in src/scripts/plugin/videojs.vast.vpaid.js - About 1 day to fix

              Function VASTPlugin has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
              Open

              module.exports = function VASTPlugin(options) {
                var snapshot;
                var player = this;
                var vast = new VASTClient();
                var adsCanceled = false;
              Severity: Minor
              Found in src/scripts/plugin/videojs.vast.vpaid.js - About 1 day 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 VASTClient.spec.js has 547 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              'use strict';
              
              /*jslint maxlen: 700 */
              describe("VASTClient", function () {
              
              
              Severity: Major
              Found in test/ads/vast/VASTClient.spec.js - About 1 day to fix

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

                    it("must not prevent the manual progress after the ad has ended", function(){
                      var response = new VASTResponse();
                      response._addMediaFiles([
                        createMediaFile('http://fakeVideoFile', 'video/mp4')
                      ]);
                Severity: Major
                Found in test/plugin/videojs.vast.spec.js and 1 other location - About 1 day to fix
                test/plugin/videojs.vast.spec.js on lines 655..672

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

                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 not prevent the manual progress after the ad has been canceled", function(){
                      var response = new VASTResponse();
                      response._addMediaFiles([
                        createMediaFile('http://fakeVideoFile', 'video/mp4')
                      ]);
                Severity: Major
                Found in test/plugin/videojs.vast.spec.js and 1 other location - About 1 day to fix
                test/plugin/videojs.vast.spec.js on lines 636..653

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

                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("utilities.isDefined", function () {
                  it("must return false if you pass undefined", function () {
                    assert.isFalse(utilities.isDefined());
                    assert.isFalse(utilities.isDefined(undefined));
                  });
                Severity: Major
                Found in test/utils/utilityFunctions.spec.js and 1 other location - About 1 day to fix
                test/utils/utilityFunctions.spec.js on lines 40..54

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

                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("utilities.isUndefined", function () {
                  it("must return true if you pass undefined", function () {
                    assert.isTrue(utilities.isUndefined());
                    assert.isTrue(utilities.isUndefined(undefined));
                  });
                Severity: Major
                Found in test/utils/utilityFunctions.spec.js and 1 other location - About 1 day to fix
                test/utils/utilityFunctions.spec.js on lines 24..38

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

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

                'use strict';
                
                describe("VASTResponse", function () {
                
                  var Ad = require('ads/vast/Ad');
                Severity: Minor
                Found in test/ads/vast/VASTResponse.spec.js - About 7 hrs to fix

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

                    describe("customClicks", function () {
                      it("must be an array", function () {
                        assert.isArray(videoClicks.customClicks);
                      });
                  
                  
                  Severity: Major
                  Found in test/ads/vast/VideoClicks.spec.js and 1 other location - About 7 hrs to fix
                  test/ads/vast/VideoClicks.spec.js on lines 24..45

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 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

                  Severity
                  Category
                  Status
                  Source
                  Language