estimancy/projestimate

View on GitHub
app/assets/javascripts/spectrum.js

Summary

Maintainability
F
2 wks
Test Coverage

File spectrum.js has 1751 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Spectrum Colorpicker v1.5.1
// https://github.com/bgrins/spectrum
// Author: Brian Grinstead
// License: MIT

Severity: Major
Found in app/assets/javascripts/spectrum.js - About 4 days to fix

    Function spectrum has 597 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function spectrum(element, o) {
    
            var opts = instanceOptions(o, element),
                flat = opts.flat,
                showSelectionPalette = opts.showSelectionPalette,
    Severity: Major
    Found in app/assets/javascripts/spectrum.js - About 2 days to fix

      Function initialize has 145 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function initialize() {
      
                  if (IE) {
                      container.find("*:not(input)").attr("unselectable", "on");
                  }
      Severity: Major
      Found in app/assets/javascripts/spectrum.js - About 5 hrs to fix

        Function draggable has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function draggable(element, onmove, onstart, onstop) {
                onmove = onmove || function () { };
                onstart = onstart || function () { };
                onstop = onstop || function () { };
                var doc = document;
        Severity: Major
        Found in app/assets/javascripts/spectrum.js - About 2 hrs to fix

          Function updateUI has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function updateUI() {
          
                      textInput.removeClass("sp-validation-error");
          
                      updateHelperLocations();
          Severity: Major
          Found in app/assets/javascripts/spectrum.js - About 2 hrs to fix

            Function stringInputToObject has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function stringInputToObject(color) {
            
                    color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();
                    var named = false;
                    if (names[color]) {
            Severity: Major
            Found in app/assets/javascripts/spectrum.js - About 2 hrs to fix

              Function markup has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  markup = (function () {
              
                      // IE does not support gradients with multiple stops, so we need to simulate
                      //  that for the rainbow slider with 8 divs that each have a single gradient
                      var gradientFix = "";
              Severity: Minor
              Found in app/assets/javascripts/spectrum.js - About 1 hr to fix

                Function inputToRGB has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function inputToRGB(color) {
                
                        var rgb = { r: 0, g: 0, b: 0 };
                        var a = 1;
                        var ok = false;
                Severity: Minor
                Found in app/assets/javascripts/spectrum.js - About 1 hr to fix

                  Function toString has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          toString: function(format) {
                              var formatSet = !!format;
                              format = format || this._format;
                  
                              var formattedString = false;
                  Severity: Minor
                  Found in app/assets/javascripts/spectrum.js - About 1 hr to fix

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

                        $.fn.spectrum = function (opts, extra) {
                    
                            if (typeof opts == "string") {
                    
                                var returnValue = this;
                    Severity: Minor
                    Found in app/assets/javascripts/spectrum.js - About 1 hr to fix

                      Function updateHelperLocations has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              function updateHelperLocations() {
                                  var s = currentSaturation;
                                  var v = currentValue;
                      
                                  if(allowEmpty && isEmpty) {
                      Severity: Minor
                      Found in app/assets/javascripts/spectrum.js - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                    if ((readable && ! bestIsReadable) ||
                                        (readable && bestIsReadable && score > bestScore) ||
                                        ((! readable) && (! bestIsReadable) && score > bestScore)) {
                                        bestIsReadable = readable;
                                        bestScore = score;
                        Severity: Critical
                        Found in app/assets/javascripts/spectrum.js - About 1 hr to fix

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

                                  function applyOptions() {
                          
                                      if (opts.showPaletteOnly) {
                                          opts.showPalette = true;
                                      }
                          Severity: Minor
                          Found in app/assets/javascripts/spectrum.js - About 1 hr to fix

                            Avoid too many return statements within this function.
                            Open

                                        return { h: match[1], s: match[2], v: match[3] };
                            Severity: Major
                            Found in app/assets/javascripts/spectrum.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return {
                                              r: parseIntFromHex(match[1]),
                                              g: parseIntFromHex(match[2]),
                                              b: parseIntFromHex(match[3]),
                                              format: named ? "name" : "hex"
                              Severity: Major
                              Found in app/assets/javascripts/spectrum.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        return false;
                                Severity: Major
                                Found in app/assets/javascripts/spectrum.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                              return {
                                                  r: parseIntFromHex(match[1] + '' + match[1]),
                                                  g: parseIntFromHex(match[2] + '' + match[2]),
                                                  b: parseIntFromHex(match[3] + '' + match[3]),
                                                  format: named ? "name" : "hex"
                                  Severity: Major
                                  Found in app/assets/javascripts/spectrum.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                                return { h: match[1], s: match[2], l: match[3], a: match[4] };
                                    Severity: Major
                                    Found in app/assets/javascripts/spectrum.js - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                  return {
                                                      a: convertHexToDecimal(match[1]),
                                                      r: parseIntFromHex(match[2]),
                                                      g: parseIntFromHex(match[3]),
                                                      b: parseIntFromHex(match[4]),
                                      Severity: Major
                                      Found in app/assets/javascripts/spectrum.js - About 30 mins to fix

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

                                                toHsvString: function() {
                                                    var hsv = rgbToHsv(this._r, this._g, this._b);
                                                    var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
                                                    return (this._a == 1) ?
                                                      "hsv("  + h + ", " + s + "%, " + v + "%)" :
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 1 other location - About 6 hrs to fix
                                        app/assets/javascripts/spectrum.js on lines 1242..1248

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

                                        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

                                                toHslString: function() {
                                                    var hsl = rgbToHsl(this._r, this._g, this._b);
                                                    var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
                                                    return (this._a == 1) ?
                                                      "hsl("  + h + ", " + s + "%, " + l + "%)" :
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 1 other location - About 6 hrs to fix
                                        app/assets/javascripts/spectrum.js on lines 1231..1237

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

                                        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

                                                if(s === 0) {
                                                    r = g = b = l; // achromatic
                                                }
                                                else {
                                                    var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 1 other location - About 5 hrs to fix
                                        app/assets/javascripts/jit-2.0.1-excanvas.js on lines 419..427

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

                                        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

                                            function triad(color) {
                                                var hsl = tinycolor(color).toHsl();
                                                var h = hsl.h;
                                                return [
                                                    tinycolor(color),
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 1 other location - About 4 hrs to fix
                                        app/assets/javascripts/spectrum.js on lines 1761..1769

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

                                        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

                                            function splitcomplement(color) {
                                                var hsl = tinycolor(color).toHsl();
                                                var h = hsl.h;
                                                return [
                                                    tinycolor(color),
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 1 other location - About 4 hrs to fix
                                        app/assets/javascripts/spectrum.js on lines 1740..1748

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

                                        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

                                            function saturate(color, amount) {
                                                amount = (amount === 0) ? 0 : (amount || 10);
                                                var hsl = tinycolor(color).toHsl();
                                                hsl.s += amount / 100;
                                                hsl.s = clamp01(hsl.s);
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 1 other location - About 2 hrs to fix
                                        app/assets/javascripts/spectrum.js on lines 1695..1701

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

                                        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

                                            function lighten (color, amount) {
                                                amount = (amount === 0) ? 0 : (amount || 10);
                                                var hsl = tinycolor(color).toHsl();
                                                hsl.l += amount / 100;
                                                hsl.l = clamp01(hsl.l);
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 1 other location - About 2 hrs to fix
                                        app/assets/javascripts/spectrum.js on lines 1683..1689

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

                                        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

                                                    switch(max) {
                                                        case r: h = (g - b) / d + (g < b ? 6 : 0); break;
                                                        case g: h = (b - r) / d + 2; break;
                                                        case b: h = (r - g) / d + 4; break;
                                                    }
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 1 other location - About 2 hrs to fix
                                        app/assets/javascripts/spectrum.js on lines 1521..1525

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

                                        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

                                                    switch(max) {
                                                        case r: h = (g - b) / d + (g < b ? 6 : 0); break;
                                                        case g: h = (b - r) / d + 2; break;
                                                        case b: h = (r - g) / d + 4; break;
                                                    }
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 1 other location - About 2 hrs to fix
                                        app/assets/javascripts/spectrum.js on lines 1587..1591

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

                                        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

                                                    else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("l")) {
                                                        color.s = convertToPercentage(color.s);
                                                        color.l = convertToPercentage(color.l);
                                                        rgb = hslToRgb(color.h, color.s, color.l);
                                                        ok = true;
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 1 other location - About 2 hrs to fix
                                        app/assets/javascripts/spectrum.js on lines 1450..1463

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

                                                    else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("v")) {
                                                        color.s = convertToPercentage(color.s);
                                                        color.v = convertToPercentage(color.v);
                                                        rgb = hsvToRgb(color.h, color.s, color.v);
                                                        ok = true;
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 1 other location - About 2 hrs to fix
                                        app/assets/javascripts/spectrum.js on lines 1457..1463

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

                                                toHsv: function() {
                                                    var hsv = rgbToHsv(this._r, this._g, this._b);
                                                    return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
                                                },
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 1 other location - About 2 hrs to fix
                                        app/assets/javascripts/spectrum.js on lines 1238..1241

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

                                        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

                                                toHsl: function() {
                                                    var hsl = rgbToHsl(this._r, this._g, this._b);
                                                    return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
                                                },
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 1 other location - About 2 hrs to fix
                                        app/assets/javascripts/spectrum.js on lines 1227..1230

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

                                        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

                                                      "rgb("  + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" :
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 1 other location - About 2 hrs to fix
                                        app/assets/javascripts/spectrum.js on lines 1275..1275

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

                                        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

                                                      "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 1 other location - About 2 hrs to fix
                                        app/assets/javascripts/spectrum.js on lines 1274..1274

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

                                        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

                                                if ((match = matchers.rgba.exec(color))) {
                                                    return { r: match[1], g: match[2], b: match[3], a: match[4] };
                                                }
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 1 other location - About 1 hr to fix
                                        app/assets/javascripts/spectrum.js on lines 2210..2212

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

                                        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

                                                if ((match = matchers.hsla.exec(color))) {
                                                    return { h: match[1], s: match[2], l: match[3], a: match[4] };
                                                }
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 1 other location - About 1 hr to fix
                                        app/assets/javascripts/spectrum.js on lines 2204..2206

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

                                        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

                                                if ((match = matchers.rgb.exec(color))) {
                                                    return { r: match[1], g: match[2], b: match[3] };
                                                }
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 2 other locations - About 55 mins to fix
                                        app/assets/javascripts/spectrum.js on lines 2207..2209
                                        app/assets/javascripts/spectrum.js on lines 2213..2215

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

                                        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

                                                if ((match = matchers.hsl.exec(color))) {
                                                    return { h: match[1], s: match[2], l: match[3] };
                                                }
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 2 other locations - About 55 mins to fix
                                        app/assets/javascripts/spectrum.js on lines 2201..2203
                                        app/assets/javascripts/spectrum.js on lines 2213..2215

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

                                        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

                                                if ((match = matchers.hsv.exec(color))) {
                                                    return { h: match[1], s: match[2], v: match[3] };
                                                }
                                        Severity: Major
                                        Found in app/assets/javascripts/spectrum.js and 2 other locations - About 55 mins to fix
                                        app/assets/javascripts/spectrum.js on lines 2201..2203
                                        app/assets/javascripts/spectrum.js on lines 2207..2209

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

                                        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

                                                      "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
                                        Severity: Minor
                                        Found in app/assets/javascripts/spectrum.js and 1 other location - About 40 mins to fix
                                        app/assets/javascripts/spectrum.js on lines 1266..1266

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

                                        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

                                                      "rgb("  + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" :
                                        Severity: Minor
                                        Found in app/assets/javascripts/spectrum.js and 1 other location - About 40 mins to fix
                                        app/assets/javascripts/spectrum.js on lines 1267..1267

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

                                        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