sharetribe/sharetribe

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

Summary

Maintainability
F
2 wks
Test Coverage

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

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

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

    Function spectrum has 625 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/admin2/spectrum.js - About 3 days to fix

      Function initialize has 148 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/admin2/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/admin2/spectrum.js - About 2 hrs to fix

          Function stringInputToObject has 54 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/admin2/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/admin2/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/admin2/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/admin2/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/admin2/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/admin2/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/admin2/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/admin2/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/admin2/spectrum.js - About 1 hr to fix

                            Consider simplifying this complex logical expression.
                            Open

                                        if (dragging) {
                                            // Mouseup happened outside of window
                                            if (IE && doc.documentMode < 9 && !e.button) {
                                                return stop();
                                            }
                            Severity: Major
                            Found in app/assets/javascripts/admin2/spectrum.js - About 1 hr to fix

                              Avoid too many return statements within this function.
                              Open

                                      return false;
                              Severity: Major
                              Found in app/assets/javascripts/admin2/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/admin2/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/admin2/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/admin2/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/admin2/spectrum.js - About 30 mins 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/admin2/spectrum.js - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                      return { h: match[1], s: match[2], v: match[3], a: match[4] };
                                          Severity: Major
                                          Found in app/assets/javascripts/admin2/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/admin2/spectrum.js and 1 other location - About 6 hrs to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 1307..1313

                                            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/admin2/spectrum.js and 1 other location - About 6 hrs to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 1296..1302

                                            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

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

                                            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 triad(color) {
                                                    var hsl = tinycolor(color).toHsl();
                                                    var h = hsl.h;
                                                    return [
                                                        tinycolor(color),
                                            Severity: Major
                                            Found in app/assets/javascripts/admin2/spectrum.js and 1 other location - About 4 hrs to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 1826..1834

                                            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 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/admin2/spectrum.js and 1 other location - About 2 hrs to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 1748..1754

                                            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 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/admin2/spectrum.js and 1 other location - About 2 hrs to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 1760..1766

                                            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/admin2/spectrum.js and 1 other location - About 2 hrs to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 1586..1590

                                            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/admin2/spectrum.js and 1 other location - About 2 hrs to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 1652..1656

                                            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("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/admin2/spectrum.js and 1 other location - About 2 hrs to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 1522..1528

                                            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("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/admin2/spectrum.js and 1 other location - About 2 hrs to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 1515..1528

                                            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/admin2/spectrum.js and 1 other location - About 2 hrs to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 1303..1306

                                            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/admin2/spectrum.js and 1 other location - About 2 hrs to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 1292..1295

                                            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

                                                          "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/admin2/spectrum.js and 1 other location - About 2 hrs to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 1339..1339

                                            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

                                                          "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/admin2/spectrum.js and 1 other location - About 2 hrs to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 1340..1340

                                            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 3 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/admin2/spectrum.js and 2 other locations - About 1 hr to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 2271..2273
                                            app/assets/javascripts/admin2/spectrum.js on lines 2283..2285

                                            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.hsva.exec(color))) {
                                                        return { h: match[1], s: match[2], v: match[3], a: match[4] };
                                                    }
                                            Severity: Major
                                            Found in app/assets/javascripts/admin2/spectrum.js and 2 other locations - About 1 hr to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 2271..2273
                                            app/assets/javascripts/admin2/spectrum.js on lines 2277..2279

                                            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.rgba.exec(color))) {
                                                        return { r: match[1], g: match[2], b: match[3], a: match[4] };
                                                    }
                                            Severity: Major
                                            Found in app/assets/javascripts/admin2/spectrum.js and 2 other locations - About 1 hr to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 2277..2279
                                            app/assets/javascripts/admin2/spectrum.js on lines 2283..2285

                                            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.hsl.exec(color))) {
                                                        return { h: match[1], s: match[2], l: match[3] };
                                                    }
                                            Severity: Major
                                            Found in app/assets/javascripts/admin2/spectrum.js and 2 other locations - About 55 mins to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 2268..2270
                                            app/assets/javascripts/admin2/spectrum.js on lines 2280..2282

                                            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.rgb.exec(color))) {
                                                        return { r: match[1], g: match[2], b: match[3] };
                                                    }
                                            Severity: Major
                                            Found in app/assets/javascripts/admin2/spectrum.js and 2 other locations - About 55 mins to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 2274..2276
                                            app/assets/javascripts/admin2/spectrum.js on lines 2280..2282

                                            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/admin2/spectrum.js and 2 other locations - About 55 mins to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 2268..2270
                                            app/assets/javascripts/admin2/spectrum.js on lines 2274..2276

                                            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/admin2/spectrum.js and 1 other location - About 40 mins to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 1331..1331

                                            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/admin2/spectrum.js and 1 other location - About 40 mins to fix
                                            app/assets/javascripts/admin2/spectrum.js on lines 1332..1332

                                            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