jansanchez/css-url-versioner

View on GitHub

Showing 12 of 12 total issues

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

    describe('With double quotes: "', function() {
      var i, j, ref;
      for (i = j = 0, ref = withDoubleQuotes.length / 2 - 1; 0 <= ref ? j <= ref : j >= ref; i = 0 <= ref ? ++j : --j) {
        describe(withDoubleQuotes[i * 2], assertVersioned(withDoubleQuotes, i * 2));
      }
Severity: Major
Found in test/lib/css-url-versioner.js and 2 other locations - About 4 hrs to fix
test/lib/css-url-versioner.js on lines 80..85
test/lib/css-url-versioner.js on lines 87..92

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

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

    describe('Without quotes:', function() {
      var i, j, ref;
      for (i = j = 0, ref = withoutQuotes.length / 2 - 1; 0 <= ref ? j <= ref : j >= ref; i = 0 <= ref ? ++j : --j) {
        describe(withoutQuotes[i * 2], assertVersioned(withoutQuotes, i * 2));
      }
Severity: Major
Found in test/lib/css-url-versioner.js and 2 other locations - About 4 hrs to fix
test/lib/css-url-versioner.js on lines 87..92
test/lib/css-url-versioner.js on lines 94..99

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

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

    describe("With single quotes: '", function() {
      var i, j, ref;
      for (i = j = 0, ref = withSingleQuotes.length / 2 - 1; 0 <= ref ? j <= ref : j >= ref; i = 0 <= ref ? ++j : --j) {
        describe(withSingleQuotes[i * 2], assertVersioned(withSingleQuotes, i * 2));
      }
Severity: Major
Found in test/lib/css-url-versioner.js and 2 other locations - About 4 hrs to fix
test/lib/css-url-versioner.js on lines 80..85
test/lib/css-url-versioner.js on lines 94..99

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

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

CssUrlVersioner.prototype.getNumeral = function(url, pattern) {
  var ArrayOfNumerals, numeral, numerals;
  ArrayOfNumerals = url.match(pattern);
  numeral = "";
  if (ArrayOfNumerals !== null) {
Severity: Major
Found in dist/package/lib/css-url-versioner.js and 1 other location - About 3 hrs to fix
dist/package/lib/css-url-versioner.js on lines 81..90

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

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

CssUrlVersioner.prototype.getQuote = function(url, pattern) {
  var ArrayOfQuotes, Quoutes, quote;
  ArrayOfQuotes = url.match(pattern);
  quote = "";
  if (ArrayOfQuotes !== null) {
Severity: Major
Found in dist/package/lib/css-url-versioner.js and 1 other location - About 3 hrs to fix
dist/package/lib/css-url-versioner.js on lines 92..101

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

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

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

CssUrlVersioner.prototype.insertVersion = function() {
  var arrayUrl, dot, doubleQuotes, extension, i, len, newRegEx, newString, numeral, patternExt, patternQuotes, patternRightBracket, patternSimbols, patternUrl, quote, singleQuote, theLastPartOfTheRegExp, url;
  patternUrl = /url([\(]{1})([\"|\']?)([a-zA-Z0-9\@\.\/\s_-]+)([\#]?[a-zA-Z0-9_-]+)?([\"|\']?)([\)]{1})/g;
  patternQuotes = /(\"|\')/g;
  patternExt = /(\.{1}[a-zA-Z0-9]{2,4})(\"|\')?/g;
Severity: Minor
Found in dist/package/lib/css-url-versioner.js - About 1 hr to fix

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

        withSingleQuotes = ["url('sprite.png')", "url('sprite.png" + queryString + "')", "url('fonts/new.eot#ie')", "url('fonts/new.eot" + queryString + "#ie')", "url('img/abc.dfg.png')", "url('img/abc.dfg.png" + queryString + "')", "url('img/klm.nop.png#slug')", "url('img/klm.nop.png" + queryString + "#slug')", "url('file with space.woff')", "url('file with space.woff" + queryString + "')"];
    Severity: Major
    Found in test/lib/css-url-versioner.js and 2 other locations - About 1 hr to fix
    test/lib/css-url-versioner.js on lines 79..79
    test/lib/css-url-versioner.js on lines 93..93

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

    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

        withoutQuotes = ['url(sprite.png)', 'url(sprite.png' + queryString + ')', 'url(fonts/new.eot#ie)', 'url(fonts/new.eot' + queryString + '#ie)', 'url(img/abc.dfg.png)', 'url(img/abc.dfg.png' + queryString + ')', 'url(img/klm.nop.png#slug)', 'url(img/klm.nop.png' + queryString + '#slug)', 'url(file with space.woff)', 'url(file with space.woff' + queryString + ')'];
    Severity: Major
    Found in test/lib/css-url-versioner.js and 2 other locations - About 1 hr to fix
    test/lib/css-url-versioner.js on lines 86..86
    test/lib/css-url-versioner.js on lines 93..93

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

    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

        withDoubleQuotes = ['url("sprite.png")', 'url("sprite.png' + queryString + '")', 'url("fonts/new.eot#ie")', 'url("fonts/new.eot' + queryString + '#ie")', 'url("img/abc.dfg.png")', 'url("img/abc.dfg.png' + queryString + '")', 'url("img/klm.nop.png#slug")', 'url("img/klm.nop.png' + queryString + '#slug")', 'url("file with space.woff")', 'url("file with space.woff' + queryString + '")'];
    Severity: Major
    Found in test/lib/css-url-versioner.js and 2 other locations - About 1 hr to fix
    test/lib/css-url-versioner.js on lines 79..79
    test/lib/css-url-versioner.js on lines 86..86

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

    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

    version = d.getFullYear().toString() + (d.getMonth() + 1).toString() + d.getDate().toString();
    Severity: Major
    Found in test/lib/css-url-versioner.js and 1 other location - About 1 hr to fix
    dist/package/lib/css-url-versioner.js on lines 68..68

    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

      this.version = d.getFullYear().toString() + (d.getMonth() + 1).toString() + d.getDate().toString();
    Severity: Major
    Found in dist/package/lib/css-url-versioner.js and 1 other location - About 1 hr to fix
    test/lib/css-url-versioner.js on lines 15..15

    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

    Function getTheLastPart has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    CssUrlVersioner.prototype.getTheLastPart = function(quote, numeral, singleQuote, doubleQuotes, patternSimbols) {
    Severity: Minor
    Found in dist/package/lib/css-url-versioner.js - About 35 mins to fix
      Severity
      Category
      Status
      Source
      Language