MailOnline/videojs-vast-vpaid

View on GitHub
test/ads/vast/VASTClient.spec.js

Summary

Maintainability
F
1 wk
Test Coverage

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

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

          it("must pass a 101 error to the callback and track it if one of the ads on the adChain returned an inline and a wrapper on the same 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 3 other locations - About 5 hrs to fix
    test/ads/vast/VASTClient.spec.js on lines 508..523
    test/ads/vast/VASTClient.spec.js on lines 525..540
    test/ads/vast/VASTClient.spec.js on lines 542..557

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

    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 pass a 101 error to the callback and track it if the ad in the chain had neither a wrapper nor an inline", function(){
            var adTagUrl = 'http://foo.bar/';
            vast._getVASTAd(adTagUrl, callback);
            this.clock.tick();
    
    
    Severity: Major
    Found in test/ads/vast/VASTClient.spec.js and 3 other locations - About 5 hrs to fix
    test/ads/vast/VASTClient.spec.js on lines 491..506
    test/ads/vast/VASTClient.spec.js on lines 525..540
    test/ads/vast/VASTClient.spec.js on lines 542..557

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

    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 return a 101 error to the callback and track it if one of the ads in the chain is a wrapper with no VASTAdTagURI", function(){
            var adTagUrl = 'http://foo.bar/';
            vast._getVASTAd(adTagUrl, callback);
            this.clock.tick();
    
    
    Severity: Major
    Found in test/ads/vast/VASTClient.spec.js and 3 other locations - About 5 hrs to fix
    test/ads/vast/VASTClient.spec.js on lines 491..506
    test/ads/vast/VASTClient.spec.js on lines 508..523
    test/ads/vast/VASTClient.spec.js on lines 525..540

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

    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 return a 101 error to the callback and track it if one of the ads in the chain contains an inline with no creative", function(){
            var adTagUrl = 'http://foo.bar/';
            vast._getVASTAd(adTagUrl, callback);
            this.clock.tick();
    
    
    Severity: Major
    Found in test/ads/vast/VASTClient.spec.js and 3 other locations - About 5 hrs to fix
    test/ads/vast/VASTClient.spec.js on lines 491..506
    test/ads/vast/VASTClient.spec.js on lines 508..523
    test/ads/vast/VASTClient.spec.js on lines 542..557

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

    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 pass a 301 error to the callback if there was an error with the request", function(){
            var adTagUrl = 'http://foo.bar/';
            vast._getVASTAd(adTagUrl, callback);
            this.clock.tick();
            requests[0].respond(404, {"Content-Type": "text"}, '404 Not found');
    Severity: Major
    Found in test/ads/vast/VASTClient.spec.js and 1 other location - About 2 hrs to fix
    test/ads/vast/VASTClient.spec.js on lines 376..384

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

    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 pass a 100 error to the callback if there was an error parsing the XML", function(){
            var adTagUrl = 'http://foo.bar/';
            vast._getVASTAd(adTagUrl, callback);
            this.clock.tick();
            requests[0].respond(200, {"Content-Type": "application/xml"}, 'wrong xml');
    Severity: Major
    Found in test/ads/vast/VASTClient.spec.js and 1 other location - About 2 hrs to fix
    test/ads/vast/VASTClient.spec.js on lines 366..374

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

    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

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

      function createProgressTrackEvent(uri, offset) {
        var trackingXML = '<Tracking event="progress" offset="' + offset + '">' +
          '<![CDATA[' + uri + ']]>' +
          '</Tracking>';
        return new TrackingEvent(xml.toJXONTree(trackingXML));
    Severity: Major
    Found in test/ads/vast/VASTClient.spec.js and 5 other locations - About 1 hr to fix
    test/ads/vast/VASTIntegrator.spec.js on lines 31..36
    test/ads/vast/VASTResponse.spec.js on lines 269..274
    test/ads/vast/VASTTracker.spec.js on lines 16..21
    test/ads/vpaid/VPAIDIntegrator.spec.js on lines 112..117
    test/plugin/videojs.vast.spec.js on lines 37..42

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

    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

            var inlineAdTree = xml.toJXONTree(vastInLineXML('<Creatives>' +
              '<Creative>' +
              '<Linear>' +
              '<Duration>00:00:58</Duration>' +
              '<MediaFiles>' +
    Severity: Minor
    Found in test/ads/vast/VASTClient.spec.js and 1 other location - About 30 mins to fix
    test/ads/vast/Linear.spec.js on lines 34..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 45.

    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

    There are no issues that match your filters.

    Category
    Status