MailOnline/videojs-vast-vpaid

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

Summary

Maintainability
D
1 day
Test Coverage

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

    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

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

    it("must return true if at least one of the mediaFiles is supported", function () {
      linear.mediaFiles = [
        {
          isSupported: function () {
            return false;
Severity: Major
Found in test/ads/vast/Linear.spec.js and 1 other location - About 1 hr to fix
test/ads/vast/Linear.spec.js on lines 204..219

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

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 false if none of the mediaFiles are supported", function () {
      linear.mediaFiles = [
        {
          isSupported: function () {
            return false;
Severity: Major
Found in test/ads/vast/Linear.spec.js and 1 other location - About 1 hr to fix
test/ads/vast/Linear.spec.js on lines 187..202

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

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

    it("must contain the duration specified on the xml in ms", function () {
      var linearXML = '<Linear><Duration>00:00:58</Duration></Linear>';
      var linear = new Linear(xml.toJXONTree(linearXML));
      assert.equal(linear.duration, 58000);
    });
Severity: Major
Found in test/ads/vast/Linear.spec.js and 5 other locations - About 1 hr to fix
test/ads/vast/Creative.spec.js on lines 21..25
test/ads/vast/Creative.spec.js on lines 27..31
test/ads/vast/Linear.spec.js on lines 115..119
test/ads/vast/Linear.spec.js on lines 121..125
test/ads/vast/Linear.spec.js on lines 127..131

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

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

    it("must be possible to set the skipoffset as a percentage with decimals", function () {
      var linearXML = '<Linear skipoffset="10.5%"><Duration>00:00:01</Duration></Linear>';
      var linear = new Linear(xml.toJXONTree(linearXML));
      assert.equal(linear.skipoffset, 105);
    });
Severity: Major
Found in test/ads/vast/Linear.spec.js and 5 other locations - About 1 hr to fix
test/ads/vast/Creative.spec.js on lines 21..25
test/ads/vast/Creative.spec.js on lines 27..31
test/ads/vast/Linear.spec.js on lines 19..23
test/ads/vast/Linear.spec.js on lines 115..119
test/ads/vast/Linear.spec.js on lines 121..125

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

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

    it("must contain whatever is set on the xml but parsed into ms", function () {
      var linearXML = '<Linear skipoffset="00:00:05.000"></Linear>';
      var linear = new Linear(xml.toJXONTree(linearXML));
      assert.equal(linear.skipoffset, 5000);
    });
Severity: Major
Found in test/ads/vast/Linear.spec.js and 5 other locations - About 1 hr to fix
test/ads/vast/Creative.spec.js on lines 21..25
test/ads/vast/Creative.spec.js on lines 27..31
test/ads/vast/Linear.spec.js on lines 19..23
test/ads/vast/Linear.spec.js on lines 121..125
test/ads/vast/Linear.spec.js on lines 127..131

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

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

    it("must be possible to set the skipoffset as a percentage", function () {
      var linearXML = '<Linear skipoffset="10%"><Duration>00:00:01</Duration></Linear>';
      var linear = new Linear(xml.toJXONTree(linearXML));
      assert.equal(linear.skipoffset, 100);
    });
Severity: Major
Found in test/ads/vast/Linear.spec.js and 5 other locations - About 1 hr to fix
test/ads/vast/Creative.spec.js on lines 21..25
test/ads/vast/Creative.spec.js on lines 27..31
test/ads/vast/Linear.spec.js on lines 19..23
test/ads/vast/Linear.spec.js on lines 115..119
test/ads/vast/Linear.spec.js on lines 127..131

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

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

    it("must be an instance of videoClicks", function () {
      var linearXML = '<Linear><VideoClicks></VideoClicks></Linear>';
      var linear = new Linear(xml.toJXONTree(linearXML));
      assert.instanceOf(linear.videoClicks, VideoClicks);
    });
Severity: Major
Found in test/ads/vast/Linear.spec.js and 2 other locations - About 1 hr to fix
test/ads/vast/Ad.spec.js on lines 39..43
test/ads/vast/Ad.spec.js on lines 45..49

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

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 an instance of Linear", function () {
    var linear = new Linear(xml.toJXONTree('<Linear></Linear>'));
    assert.instanceOf(linear, Linear);
  });
Severity: Minor
Found in test/ads/vast/Linear.spec.js and 1 other location - About 35 mins to fix
test/ads/vast/Companion.spec.js on lines 7..10

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

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 linearXML = '<?xml version="1.0" encoding="UTF-8"?>' +
        '<Linear>' +
        '<Duration>00:00:58</Duration>' +
        '<MediaFiles>' +
        '<MediaFile id="1" delivery="progressive" type="video/x-flv" bitrate="457" width="300" height="225">' +
Severity: Minor
Found in test/ads/vast/Linear.spec.js and 1 other location - About 30 mins to fix
test/ads/vast/VASTClient.spec.js on lines 176..187

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