MailOnline/videojs-vast-vpaid

View on GitHub

Showing 91 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

        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

          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

                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

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

                  'use strict';
                  
                  var MimeTypes = require('../../utils/mimetypes');
                  var VASTError = require('../vast/VASTError');
                  var VASTResponse = require('../vast/VASTResponse');
                  Severity: Minor
                  Found in src/scripts/ads/vpaid/VPAIDIntegrator.js - About 6 hrs to fix

                    Function _setupEvents has 136 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    VPAIDIntegrator.prototype._setupEvents = function (adUnit, vastResponse, next) {
                      var adUnitSrc = adUnit.options.src;
                      var tracker = this._createVASTTracker(adUnitSrc, vastResponse);
                      var player = this.player;
                      var that = this;
                    Severity: Major
                    Found in src/scripts/ads/vpaid/VPAIDIntegrator.js - About 5 hrs to fix

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

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

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

                        var dom = require('utils/dom');
                        var testUtils = require('../test-utils');
                        
                        describe("dom", function () {
                          var testDiv;
                        Severity: Minor
                        Found in test/utils/dom.spec.js - About 4 hrs to fix

                          Function _getVASTAd has 120 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          VASTClient.prototype._getVASTAd = function (adTagUrl, callback) {
                            var that = this;
                          
                            getAdWaterfall(adTagUrl, function (error, vastTree) {
                              var waterfallAds = vastTree && utilities.isArray(vastTree.ads) ? vastTree.ads : null;
                          Severity: Major
                          Found in src/scripts/ads/vast/VASTClient.js - About 4 hrs to fix

                            Function forEach has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function forEach(obj, iterator, context) {
                              var key, length;
                              if (obj) {
                                if (isFunction(obj)) {
                                  for (key in obj) {
                            Severity: Minor
                            Found in src/scripts/utils/utilityFunctions.js - About 4 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 JXONTree has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                            Open

                            xml.JXONTree = function JXONTree (oXMLParent) {
                              var parseText = xml.parseText;
                            
                              //The document object is an especial object that it may miss some functions or attrs depending on the browser.
                              //To prevent this problem with create the JXONTree using the root childNode which is a fully fleshed node on all supported
                            Severity: Minor
                            Found in src/scripts/utils/xml.js - About 4 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 prepareForAds has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            playerUtils.prepareForAds = function (player) {
                              var blackPoster = player.addChild('blackPoster');
                              var _firstPlay = true;
                              var volumeSnapshot;
                            
                            
                            Severity: Major
                            Found in src/scripts/utils/playerUtils.js - About 4 hrs to fix

                              Function prepareForAds has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                              Open

                              playerUtils.prepareForAds = function (player) {
                                var blackPoster = player.addChild('blackPoster');
                                var _firstPlay = true;
                                var volumeSnapshot;
                              
                              
                              Severity: Minor
                              Found in src/scripts/utils/playerUtils.js - About 4 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 tryToPlayPrerollAd has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                function tryToPlayPrerollAd() {
                                  //We remove the poster to prevent flickering whenever the content starts playing
                                  playerUtils.removeNativePoster(player);
                              
                                  playerUtils.once(player, ['vast.adsCancel', 'vast.adEnd'], function () {
                              Severity: Major
                              Found in src/scripts/plugin/videojs.vast.vpaid.js - About 3 hrs to fix

                                Function restorePlayerSnapshot has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                                Open

                                playerUtils.restorePlayerSnapshot = function restorePlayerSnapshot(player, snapshot) {
                                  var tech = player.el().querySelector('.vjs-tech');
                                  var attempts = 20; // the number of remaining attempts to restore the snapshot
                                
                                  if (snapshot.nativePoster) {
                                Severity: Minor
                                Found in src/scripts/utils/playerUtils.js - About 3 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

                                Severity
                                Category
                                Status
                                Source
                                Language