Dogfalo/materialize

View on GitHub
extras/noUiSlider/nouislider.js

Summary

Maintainability
F
1 wk
Test Coverage

Function closure has 726 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function closure ( target, options, originalOptions ){

        var actions = getActions( );

        // All variables local to 'closure' are prefixed with 'scope_'
Severity: Major
Found in extras/noUiSlider/nouislider.js - About 3 days to fix

    File nouislider.js has 1312 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * Materialize v0.100.2 (http://materializecss.com)
     * Copyright 2014-2015 Materialize
     * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
     */
    Severity: Major
    Found in extras/noUiSlider/nouislider.js - About 3 days to fix

      Function testOptions has 85 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function testOptions ( options ) {
      
              // To prove a fix for #537, freeze options here.
              // If the object is modified, an error will be thrown.
              // Object.freeze(options);
      Severity: Major
      Found in extras/noUiSlider/nouislider.js - About 3 hrs to fix

        Function generateSpread has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function generateSpread ( density, mode, group ) {
        
                    function safeIncrement(value, increment) {
                        // Avoid floating point variance by dropping the smallest decimal places.
                        return (value + increment).toFixed(7) / 1;
        Severity: Major
        Found in extras/noUiSlider/nouislider.js - About 2 hrs to fix

          Function addMarking has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function addMarking ( spread, filterFunc, formatter ) {
          
                      var element = document.createElement('div'),
                          out = '',
                          valueSizeClasses = [
          Severity: Minor
          Found in extras/noUiSlider/nouislider.js - About 1 hr to fix

            Function eventStart has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function eventStart ( event, data ) {
            
                        if ( data.handleNumbers.length === 1 ) {
            
                            var handle = scope_Handles[data.handleNumbers[0]];
            Severity: Minor
            Found in extras/noUiSlider/nouislider.js - About 1 hr to fix

              Function v has 12 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              (function(){function r(b){return b.split("").reverse().join("")}function s(b,f,c){if((b[f]||b[c])&&b[f]===b[c])throw Error(f);}function v(b,f,c,d,e,p,q,k,l,h,n,a){q=a;var m,g=n="";p&&(a=p(a));if("number"!==typeof a||!isFinite(a))return!1;b&&0===parseFloat(a.toFixed(b))&&(a=0);0>a&&(m=!0,a=Math.abs(a));b&&(p=Math.pow(10,b),a=(Math.round(a*p)/p).toFixed(b));a=a.toString();-1!==a.indexOf(".")&&(b=a.split("."),a=b[0],c&&(n=c+b[1]));f&&(a=r(a).match(/.{1,3}/g),a=r(a.join(r(f))));m&&k&&(g+=k);d&&(g+=d);
              Severity: Major
              Found in extras/noUiSlider/nouislider.js - About 1 hr to fix

                Function w has 12 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    m&&l&&(g+=l);g=g+a+n;e&&(g+=e);h&&(g=h(g,q));return g}function w(b,f,c,d,e,h,q,k,l,r,n,a){var m;b="";n&&(a=n(a));if(!a||"string"!==typeof a)return!1;k&&a.substring(0,k.length)===k&&(a=a.replace(k,""),m=!0);d&&a.substring(0,d.length)===d&&(a=a.replace(d,""));l&&a.substring(0,l.length)===l&&(a=a.replace(l,""),m=!0);e&&a.slice(-1*e.length)===e&&(a=a.slice(0,-1*e.length));f&&(a=a.split(f).join(""));c&&(a=a.replace(c,"."));m&&(b+="-");b=Number((b+a).replace(/[^0-9\.\-.]/g,""));q&&(b=q(b));return"number"===
                Severity: Major
                Found in extras/noUiSlider/nouislider.js - About 1 hr to fix

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

                          function bindSliderEvents ( behaviour ) {
                  
                              // Attach the standard drag event to the handles.
                              if ( !behaviour.fixed ) {
                  
                  
                  Severity: Minor
                  Found in extras/noUiSlider/nouislider.js - About 1 hr to fix

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

                            function getCurrentStep ( ) {
                    
                                // Check all locations, map them to their stepping point.
                                // Get the step point, then find it in the input list.
                                return scope_Locations.map(function( location, index ){
                    Severity: Minor
                    Found in extras/noUiSlider/nouislider.js - About 1 hr to fix

                      Function moveHandles has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              function moveHandles ( upward, proposal, locations, handleNumbers ) {
                      
                                  var proposals = locations.slice();
                      
                                  var b = [!upward, upward];
                      Severity: Minor
                      Found in extras/noUiSlider/nouislider.js - About 1 hr to fix

                        Function checkHandlePosition has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                function checkHandlePosition ( reference, handleNumber, to, lookBackward, lookForward ) {
                        
                                    // For sliders with multiple handles, limit movement to the other handle.
                                    // Apply the margin option by adding it to the handle positions.
                                    if ( scope_Handles.length > 1 ) {
                        Severity: Minor
                        Found in extras/noUiSlider/nouislider.js - About 1 hr to fix

                          Function handleEntryPoint has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function handleEntryPoint ( index, value, that ) {
                          
                                  var percentage;
                          
                                  // Wrap numerical input in an array.
                          Severity: Minor
                          Found in extras/noUiSlider/nouislider.js - About 1 hr to fix

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

                                    function attachEvent ( events, element, callback, data ) {
                            
                                        // This function can be used to 'filter' events to the slider.
                                        // element is a node, not a nodeList
                            
                            
                            Severity: Minor
                            Found in extras/noUiSlider/nouislider.js - About 1 hr to fix

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

                                      function checkHandlePosition ( reference, handleNumber, to, lookBackward, lookForward ) {
                              Severity: Minor
                              Found in extras/noUiSlider/nouislider.js - About 35 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                                    return false;
                                Severity: Major
                                Found in extras/noUiSlider/nouislider.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                          return xPct[j-1] + closest(
                                                  value - xPct[j-1],
                                                  xSteps[j-1]
                                              );
                                  Severity: Major
                                  Found in extras/noUiSlider/nouislider.js - About 30 mins to fix

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

                                                if ( scope_Handles.length > 1 ) {
                                    
                                                    if ( lookBackward && handleNumber > 0 ) {
                                                        to = Math.max(to, reference[handleNumber - 1] + options.margin);
                                                    }
                                    Severity: Major
                                    Found in extras/noUiSlider/nouislider.js and 1 other location - About 3 hrs to fix
                                    extras/noUiSlider/nouislider.js on lines 1737..1746

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

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

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

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

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

                                    Refactorings

                                    Further Reading

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

                                                if ( scope_Handles.length > 1 && options.limit ) {
                                    
                                                    if ( lookBackward && handleNumber > 0 ) {
                                                        to = Math.min(to, reference[handleNumber - 1] + options.limit);
                                                    }
                                    Severity: Major
                                    Found in extras/noUiSlider/nouislider.js and 1 other location - About 3 hrs to fix
                                    extras/noUiSlider/nouislider.js on lines 1723..1732

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

                                    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

                                                stepBefore: { startValue: this.xVal[j-2], step: this.xNumSteps[j-2], highestStep: this.xHighestCompleteStep[j-2] },
                                    Severity: Major
                                    Found in extras/noUiSlider/nouislider.js and 2 other locations - About 1 hr to fix
                                    extras/noUiSlider/nouislider.js on lines 431..431
                                    extras/noUiSlider/nouislider.js on lines 432..432

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

                                    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

                                                thisStep: { startValue: this.xVal[j-1], step: this.xNumSteps[j-1], highestStep: this.xHighestCompleteStep[j-1] },
                                    Severity: Major
                                    Found in extras/noUiSlider/nouislider.js and 2 other locations - About 1 hr to fix
                                    extras/noUiSlider/nouislider.js on lines 430..430
                                    extras/noUiSlider/nouislider.js on lines 432..432

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

                                    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

                                                stepAfter: { startValue: this.xVal[j-0], step: this.xNumSteps[j-0], highestStep: this.xHighestCompleteStep[j-0] }
                                    Severity: Major
                                    Found in extras/noUiSlider/nouislider.js and 2 other locations - About 1 hr to fix
                                    extras/noUiSlider/nouislider.js on lines 430..430
                                    extras/noUiSlider/nouislider.js on lines 431..431

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

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

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

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

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

                                    Refactorings

                                    Further Reading

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

                                                if ( options.dir === 0 ) {
                                                    addClass(target, options.cssClasses.ltr);
                                                } else {
                                                    addClass(target, options.cssClasses.rtl);
                                                }
                                    Severity: Minor
                                    Found in extras/noUiSlider/nouislider.js and 1 other location - About 50 mins to fix
                                    extras/noUiSlider/nouislider.js on lines 971..975

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

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

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

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

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

                                    Refactorings

                                    Further Reading

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

                                                if ( options.ort === 0 ) {
                                                    addClass(target, options.cssClasses.horizontal);
                                                } else {
                                                    addClass(target, options.cssClasses.vertical);
                                                }
                                    Severity: Minor
                                    Found in extras/noUiSlider/nouislider.js and 1 other location - About 50 mins to fix
                                    extras/noUiSlider/nouislider.js on lines 965..969

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

                                    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

                                        m&&l&&(g+=l);g=g+a+n;e&&(g+=e);h&&(g=h(g,q));return g}function w(b,f,c,d,e,h,q,k,l,r,n,a){var m;b="";n&&(a=n(a));if(!a||"string"!==typeof a)return!1;k&&a.substring(0,k.length)===k&&(a=a.replace(k,""),m=!0);d&&a.substring(0,d.length)===d&&(a=a.replace(d,""));l&&a.substring(0,l.length)===l&&(a=a.replace(l,""),m=!0);e&&a.slice(-1*e.length)===e&&(a=a.slice(0,-1*e.length));f&&(a=a.split(f).join(""));c&&(a=a.replace(c,"."));m&&(b+="-");b=Number((b+a).replace(/[^0-9\.\-.]/g,""));q&&(b=q(b));return"number"===
                                    Severity: Minor
                                    Found in extras/noUiSlider/nouislider.js and 1 other location - About 45 mins to fix
                                    extras/noUiSlider/nouislider.js on lines 9..9

                                    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

                                                updateAble.forEach(function(name){
                                                    if ( optionsToUpdate[name] !== undefined ) {
                                                        originalOptions[name] = optionsToUpdate[name];
                                                    }
                                                });
                                    Severity: Minor
                                    Found in extras/noUiSlider/nouislider.js and 1 other location - About 35 mins to fix
                                    extras/noUiSlider/nouislider.js on lines 2056..2060

                                    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

                                                updateAble.forEach(function(name){
                                                    if ( optionsToUpdate[name] !== undefined ) {
                                                        options[name] = newOptions[name];
                                                    }
                                                });
                                    Severity: Minor
                                    Found in extras/noUiSlider/nouislider.js and 1 other location - About 35 mins to fix
                                    extras/noUiSlider/nouislider.js on lines 2047..2051

                                    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