MailOnline/VPAIDFLASHClient

View on GitHub

Showing 9 of 26 total issues

VPAIDAdUnit has 26 functions (exceeds 20 allowed). Consider refactoring.
Open

export class VPAIDAdUnit extends IVPAIDAdUnit {
    constructor (flash) {
        super();
        this._destroyed = false;
        this._flash = flash;
Severity: Minor
Found in js/VPAIDAdUnit.js - About 3 hrs to fix

    JSFlashBridge has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class JSFlashBridge {
        constructor (el, flashURL, flashID, width, height, loadHandShake) {
            this._el = el;
            this._flashID = flashID;
            this._flashURL = flashURL;
    Severity: Minor
    Found in js/jsFlashBridge.js - About 2 hrs to fix

      IVPAIDAdUnit has 21 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export class IVPAIDAdUnit {
      
          //all methods below
          //are async methods
          handshakeVersion(playerVPAIDVersion = '2.0', callback = undefined) {}
      Severity: Minor
      Found in js/IVPAIDAdUnit.js - About 2 hrs to fix

        Function flashVPAIDWrapperLoaded has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function flashVPAIDWrapperLoaded(err) {
            if (err) return;
            // var adURL = 'http://cdn.innovid.com/2.62.8110/platform/vpaid/VPAIDIRollPackage.swf?configURL=http%3A%2F%2Fstatic.innovid.com%2Firoll%2Fconfig%2F1hl7lc.xml%3Fcb%3D787766d7-ebab-3656-c24f-0ddebab645e9&secure=false';
            // var adURL = 'VPAIDIRollPackage.swf?configURL=http%3A%2F%2Fstatic.innovid.com%2Firoll%2Fconfig%2F1hl7lc.xml%3Fcb%3D787766d7-ebab-3656-c24f-0ddebab645e9&secure=false';
            // var adURL = 'TestAd.swf';
        Severity: Minor
        Found in demo/demo.js - About 1 hr to fix

          Function exports has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function (karma) {
            karma.set({
              /**
               * From where to look for files, starting with the location of this file.
               */
          Severity: Minor
          Found in karma.conf.js - About 1 hr to fix

            Function constructor has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                constructor (vpaidParentEl, callback, swfConfig = {data: 'VPAIDFlash.swf', width: 800, height: 400}, params = { wmode: 'transparent', salign: 'tl', align: 'left', allowScriptAccess: 'always', scale: 'noScale', allowFullScreen: 'true', quality: 'high'}, vpaidOptions = { debug: false, timeout: 10000 }) {
            
                    var me = this;
            
                    this._vpaidParentEl = vpaidParentEl;
            Severity: Minor
            Found in js/VPAIDFLASHClient.js - About 1 hr to fix

              Function flashVPAID has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      let flashVPAID = new VPAIDFLASHClient(flashWrapper1, function () {
              
                          flashVPAID.loadAdUnit('random.swf', function (error, adUnit) {
              
                              let callback1 = sinon.spy();
              Severity: Minor
              Found in test/unit/VPAIDFLASHClient.spec.js - About 1 hr to fix

                Function VPAID_FLASH_HANDLER has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                window[VPAID_FLASH_HANDLER] = (flashID, typeID, typeName, callbackID, error, data) => {
                    let instance = registry.getInstanceByID(flashID);
                    if (!instance) return;
                    if (typeName === 'handShake') {
                        instance._handShake(error, data);
                Severity: Minor
                Found in js/jsFlashBridge.js - About 25 mins 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 loadAdUnit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    loadAdUnit(adURL, callback) {
                        $throwIfDestroyed.call(this);
                
                        if (this._adUnit) {
                            this._destroyAdUnit();
                Severity: Minor
                Found in js/VPAIDFLASHClient.js - About 25 mins 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