skywarth/Fenrir-wolfpack-simulator

View on GitHub
js/jscolor.js

Summary

Maintainability
A
1 hr
Test Coverage

Function jscolor has a Cognitive Complexity of 740 (exceeds 5 allowed). Consider refactoring.
Wontfix

if (!window.jscolor) { window.jscolor = (function () {


var jsc = {
Severity: Minor
Found in js/jscolor.js - About 2 wks to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function jscolor has 1362 lines of code (exceeds 25 allowed). Consider refactoring.
Wontfix

if (!window.jscolor) { window.jscolor = (function () {


var jsc = {
Severity: Major
Found in js/jscolor.js - About 6 days to fix

    File jscolor.js has 1365 lines of code (exceeds 250 allowed). Consider refactoring.
    Wontfix

    /**
     * jscolor - JavaScript Color Picker
     *
     * @link    http://jscolor.com
     * @license For open source use: GPLv3
    Severity: Major
    Found in js/jscolor.js - About 3 days to fix

      Function jscolor has 626 lines of code (exceeds 25 allowed). Consider refactoring.
      Wontfix

          jscolor : function (targetElement, options) {
      
              // General options
              //
              this.value = null; // initial HEX color. To change it later, use methods fromString(), fromHSV() and fromRGB()
      Severity: Major
      Found in js/jscolor.js - About 3 days to fix

        Function drawPicker has 212 lines of code (exceeds 25 allowed). Consider refactoring.
        Wontfix

                function drawPicker () {
        
                    // At this point, when drawing the picker, we know what the parent elements are
                    // and we can do all related DOM operations, such as registering events on them
                    // or checking their positioning
        Severity: Major
        Found in js/jscolor.js - About 1 day to fix

          Consider simplifying this complex logical expression.
          Wontfix

          if (!window.jscolor) { window.jscolor = (function () {
          
          
          var jsc = {
          
          Severity: Critical
          Found in js/jscolor.js - About 3 hrs to fix

            Function createPalette has 90 lines of code (exceeds 25 allowed). Consider refactoring.
            Wontfix

                createPalette : function () {
            
                    var paletteObj = {
                        elm: null,
                        draw: null
            Severity: Major
            Found in js/jscolor.js - About 3 hrs to fix

              Consider simplifying this complex logical expression.
              Wontfix

                              if (
                                  params.length >= 3 &&
                                  (mR = params[0].match(re)) &&
                                  (mG = params[1].match(re)) &&
                                  (mB = params[2].match(re))
              Severity: Critical
              Found in js/jscolor.js - About 2 hrs to fix

                Function createSliderGradient has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Wontfix

                    createSliderGradient : function () {
                
                        var sliderObj = {
                            elm: null,
                            draw: null
                Severity: Minor
                Found in js/jscolor.js - About 1 hr to fix

                  Function redrawPosition has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Wontfix

                      redrawPosition : function () {
                  
                          if (jsc.picker && jsc.picker.owner) {
                              var thisObj = jsc.picker.owner;
                  
                  Severity: Minor
                  Found in js/jscolor.js - About 1 hr to fix

                    Function fromString has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Wontfix

                            this.fromString = function (str, flags) {
                                var m;
                                if (m = str.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i)) {
                                    // HEX notation
                                    //
                    Severity: Minor
                    Found in js/jscolor.js - About 1 hr to fix

                      Function attachDOMReadyEvent has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Wontfix

                          attachDOMReadyEvent : function (func) {
                              var fired = false;
                              var fireOnce = function () {
                                  if (!fired) {
                                      fired = true;
                      Severity: Minor
                      Found in js/jscolor.js - About 1 hr to fix

                        Function redrawPad has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Wontfix

                                function redrawPad () {
                                    // redraw the pad pointer
                                    switch (jsc.getPadYComponent(THIS)) {
                                    case 's': var yComponent = 1; break;
                                    case 'v': var yComponent = 2; break;
                        Severity: Minor
                        Found in js/jscolor.js - About 1 hr to fix

                          Function onControlPointerStart has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Wontfix

                              onControlPointerStart : function (e, target, controlName, pointerType) {
                                  var thisObj = target._jscInstance;
                          
                                  jsc.preventDefault(e);
                                  jsc.captureTarget(target);
                          Severity: Minor
                          Found in js/jscolor.js - About 1 hr to fix

                            Function exportColor has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Wontfix

                                    this.exportColor = function (flags) {
                                        if (!(flags & jsc.leaveValue) && this.valueElement) {
                                            var value = this.toString();
                                            if (this.uppercase) { value = value.toUpperCase(); }
                                            if (this.hash) { value = '#' + value; }
                            Severity: Minor
                            Found in js/jscolor.js - About 1 hr to fix

                              Function importColor has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Wontfix

                                      this.importColor = function () {
                                          if (!this.valueElement) {
                                              this.exportColor();
                                          } else {
                                              if (jsc.isElementType(this.valueElement, 'input')) {
                              Severity: Minor
                              Found in js/jscolor.js - About 1 hr to fix

                                Function fromRGB has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Wontfix

                                        this.fromRGB = function (r, g, b, flags) { // null = don't change
                                            if (r !== null) {
                                                if (isNaN(r)) { return false; }
                                                r = Math.max(0, Math.min(255, r));
                                            }
                                Severity: Minor
                                Found in js/jscolor.js - About 1 hr to fix

                                  Function tryInstallOnElements has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Wontfix

                                      tryInstallOnElements : function (elms, className) {
                                          var matchClass = new RegExp('(^|\\s)(' + className + ')(\\s*(\\{[^}]*\\})|\\s|$)', 'i');
                                  
                                          for (var i = 0; i < elms.length; i += 1) {
                                              if (elms[i].type !== undefined && elms[i].type.toLowerCase() == 'color') {
                                  Severity: Minor
                                  Found in js/jscolor.js - About 1 hr to fix

                                    Function drawFunc has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Wontfix

                                                var drawFunc = function (width, height, type) {
                                                    canvas.width = width;
                                                    canvas.height = height;
                                    
                                                    ctx.clearRect(0, 0, canvas.width, canvas.height);
                                    Severity: Minor
                                    Found in js/jscolor.js - About 1 hr to fix

                                      Avoid deeply nested control flow statements.
                                      Wontfix

                                                              if (!this.fromString(this.valueElement.value, jsc.leaveValue)) {
                                                                  if (this.styleElement) {
                                                                      this.styleElement.style.backgroundImage = this.styleElement._jscOrigStyle.backgroundImage;
                                                                      this.styleElement.style.backgroundColor = this.styleElement._jscOrigStyle.backgroundColor;
                                                                      this.styleElement.style.color = this.styleElement._jscOrigStyle.color;
                                      Severity: Major
                                      Found in js/jscolor.js - About 45 mins to fix

                                        Function BoxShadow has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                        Wontfix

                                                var BoxShadow = function (hShadow, vShadow, blur, spread, color, inset) {
                                        Severity: Minor
                                        Found in js/jscolor.js - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Wontfix

                                                              } else if (!this.required && /^\s*$/.test(this.valueElement.value)) {
                                                                  this.valueElement.value = '';
                                                                  if (this.styleElement) {
                                                                      this.styleElement.style.backgroundImage = this.styleElement._jscOrigStyle.backgroundImage;
                                                                      this.styleElement.style.backgroundColor = this.styleElement._jscOrigStyle.backgroundColor;
                                          Severity: Major
                                          Found in js/jscolor.js - About 45 mins to fix

                                            Function _drawPosition has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                            Wontfix

                                                _drawPosition : function (thisObj, x, y, positionValue, contractShadow) {
                                            Severity: Minor
                                            Found in js/jscolor.js - About 35 mins to fix

                                              Function onDocumentPointerMove has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                              Wontfix

                                                  onDocumentPointerMove : function (e, target, controlName, pointerType, offset) {
                                              Severity: Minor
                                              Found in js/jscolor.js - About 35 mins to fix

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

                                                        if (typeof e.changedTouches !== 'undefined' && e.changedTouches.length) {
                                                            // touch devices
                                                            clientX = e.changedTouches[0].clientX;
                                                            clientY = e.changedTouches[0].clientY;
                                                        } else if (typeof e.clientX === 'number') {
                                                Severity: Major
                                                Found in js/jscolor.js and 1 other location - About 3 hrs to fix
                                                js/jscolor.js on lines 356..363

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

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

                                                        if (typeof e.changedTouches !== 'undefined' && e.changedTouches.length) {
                                                            // touch devices
                                                            x = e.changedTouches[0].clientX;
                                                            y = e.changedTouches[0].clientY;
                                                        } else if (typeof e.clientX === 'number') {
                                                Severity: Major
                                                Found in js/jscolor.js and 1 other location - About 3 hrs to fix
                                                js/jscolor.js on lines 377..384

                                                Duplicated Code

                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                Tuning

                                                This issue has a mass of 109.

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

                                                Identical blocks of code found in 2 locations. Consider refactoring.
                                                Wontfix

                                                                            if (this.styleElement) {
                                                                                this.styleElement.style.backgroundImage = this.styleElement._jscOrigStyle.backgroundImage;
                                                                                this.styleElement.style.backgroundColor = this.styleElement._jscOrigStyle.backgroundColor;
                                                                                this.styleElement.style.color = this.styleElement._jscOrigStyle.color;
                                                                            }
                                                Severity: Major
                                                Found in js/jscolor.js and 1 other location - About 3 hrs to fix
                                                js/jscolor.js on lines 1075..1079

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

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

                                                Identical blocks of code found in 2 locations. Consider refactoring.
                                                Wontfix

                                                                        if (this.styleElement) {
                                                                            this.styleElement.style.backgroundImage = this.styleElement._jscOrigStyle.backgroundImage;
                                                                            this.styleElement.style.backgroundColor = this.styleElement._jscOrigStyle.backgroundColor;
                                                                            this.styleElement.style.color = this.styleElement._jscOrigStyle.color;
                                                                        }
                                                Severity: Major
                                                Found in js/jscolor.js and 1 other location - About 3 hrs to fix
                                                js/jscolor.js on lines 1066..1070

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

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

                                                                var color1 = 'rgb(' +
                                                                    Math.round(rgb1[0]) + ',' +
                                                                    Math.round(rgb1[1]) + ',' +
                                                                    Math.round(rgb1[2]) + ')';
                                                Severity: Major
                                                Found in js/jscolor.js and 2 other locations - About 1 hr to fix
                                                js/jscolor.js on lines 1678..1681
                                                js/jscolor.js on lines 1686..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 67.

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

                                                                var color2 = 'rgb(' +
                                                                    Math.round(rgb2[0]) + ',' +
                                                                    Math.round(rgb2[1]) + ',' +
                                                                    Math.round(rgb2[2]) + ')';
                                                Severity: Major
                                                Found in js/jscolor.js and 2 other locations - About 1 hr to fix
                                                js/jscolor.js on lines 1674..1677
                                                js/jscolor.js on lines 1686..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 67.

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

                                                                var color1 = 'rgb(' +
                                                                    Math.round(rgb[0]) + ',' +
                                                                    Math.round(rgb[1]) + ',' +
                                                                    Math.round(rgb[2]) + ')';
                                                Severity: Major
                                                Found in js/jscolor.js and 2 other locations - About 1 hr to fix
                                                js/jscolor.js on lines 1674..1677
                                                js/jscolor.js on lines 1678..1681

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

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

                                                    detachEvent : function (el, evnt, func) {
                                                        if (el.removeEventListener) {
                                                            el.removeEventListener(evnt, func, false);
                                                        } else if (el.detachEvent) {
                                                            el.detachEvent('on' + evnt, func);
                                                Severity: Major
                                                Found in js/jscolor.js and 1 other location - About 1 hr to fix
                                                js/jscolor.js on lines 112..118

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

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

                                                    attachEvent : function (el, evnt, func) {
                                                        if (el.addEventListener) {
                                                            el.addEventListener(evnt, func, false);
                                                        } else if (el.attachEvent) {
                                                            el.attachEvent('on' + evnt, func);
                                                Severity: Major
                                                Found in js/jscolor.js and 1 other location - About 1 hr to fix
                                                js/jscolor.js on lines 121..127

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

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

                                                            if (s !== null) {
                                                                if (isNaN(s)) { return false; }
                                                                s = Math.max(0, Math.min(100, this.maxS, s), this.minS);
                                                            }
                                                Severity: Major
                                                Found in js/jscolor.js and 1 other location - About 1 hr to fix
                                                js/jscolor.js on lines 1146..1149

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

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

                                                            if (v !== null) {
                                                                if (isNaN(v)) { return false; }
                                                                v = Math.max(0, Math.min(100, this.maxV, v), this.minV);
                                                            }
                                                Severity: Major
                                                Found in js/jscolor.js and 1 other location - About 1 hr to fix
                                                js/jscolor.js on lines 1142..1145

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

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

                                                            this.hsv[2] = hsv[2]===null ? null : Math.max(0, this.minV, Math.min(100, this.maxV, hsv[2]));
                                                Severity: Major
                                                Found in js/jscolor.js and 1 other location - About 1 hr to fix
                                                js/jscolor.js on lines 1188..1188

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

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

                                                                this.hsv[1] = hsv[1]===null ? null : Math.max(0, this.minS, Math.min(100, this.maxS, hsv[1]));
                                                Severity: Major
                                                Found in js/jscolor.js and 1 other location - About 1 hr to fix
                                                js/jscolor.js on lines 1190..1190

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

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

                                                            if (r !== null) {
                                                                if (isNaN(r)) { return false; }
                                                                r = Math.max(0, Math.min(255, r));
                                                            }
                                                Severity: Minor
                                                Found in js/jscolor.js and 1 other location - About 50 mins to fix
                                                js/jscolor.js on lines 1138..1141

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

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

                                                            if (h !== null) {
                                                                if (isNaN(h)) { return false; }
                                                                h = Math.max(0, Math.min(360, h));
                                                            }
                                                Severity: Minor
                                                Found in js/jscolor.js and 1 other location - About 50 mins to fix
                                                js/jscolor.js on lines 1166..1169

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

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

                                                            if (g !== null) {
                                                                if (isNaN(g)) { return false; }
                                                                g = Math.max(0, Math.min(255, g));
                                                            }
                                                Severity: Minor
                                                Found in js/jscolor.js and 1 other location - About 45 mins to fix
                                                js/jscolor.js on lines 1174..1177

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

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

                                                            if (b !== null) {
                                                                if (isNaN(b)) { return false; }
                                                                b = Math.max(0, Math.min(255, b));
                                                            }
                                                Severity: Minor
                                                Found in js/jscolor.js and 1 other location - About 45 mins to fix
                                                js/jscolor.js on lines 1170..1173

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

                                                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 {
                                                            // Mouse is outside the picker controls -> hide the color picker!
                                                            if (jsc.picker && jsc.picker.owner) {
                                                                jsc.picker.owner.hide();
                                                            }
                                                Severity: Minor
                                                Found in js/jscolor.js and 1 other location - About 35 mins to fix
                                                js/jscolor.js on lines 570..575

                                                Duplicated Code

                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                Tuning

                                                This issue has a mass of 46.

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

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

                                                    onParentScroll : function (e) {
                                                        // hide the picker when one of the parent elements is scrolled
                                                        if (jsc.picker && jsc.picker.owner) {
                                                            jsc.picker.owner.hide();
                                                        }
                                                Severity: Minor
                                                Found in js/jscolor.js and 1 other location - About 35 mins to fix
                                                js/jscolor.js on lines 538..543

                                                Duplicated Code

                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                Tuning

                                                This issue has a mass of 46.

                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                Refactorings

                                                Further Reading

                                                There are no issues that match your filters.

                                                Category
                                                Status