seiyria/bootstrap-slider

View on GitHub

Showing 62 of 62 total issues

File bootstrap-slider.js has 1624 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! =========================================================
 * bootstrap-slider.js
 *
 * Maintainers:
 *        Kyle Kemp
Severity: Major
Found in src/js/bootstrap-slider.js - About 4 days to fix

    Function Modernizr has 605 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    window.Modernizr = (function( window, document, undefined ) {
    
        var version = '2.8.3',
    
        Modernizr = {},
    Severity: Major
    Found in dependencies/js/modernizr.js - About 3 days to fix

      Function Modernizr has a Cognitive Complexity of 117 (exceeds 5 allowed). Consider refactoring.
      Open

      window.Modernizr = (function( window, document, undefined ) {
      
          var version = '2.8.3',
      
          Modernizr = {},
      Severity: Minor
      Found in dependencies/js/modernizr.js - About 2 days 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 createNewSlider has 372 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function createNewSlider(element, options) {
      
                  /*
                      The internal state object is used to store data about the current 'state' of slider.
                      This includes values such as the `value`, `enabled`, etc...
      Severity: Major
      Found in src/js/bootstrap-slider.js - About 1 day to fix

        Function exports has 307 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function(grunt) {
        
          var packageJSON = grunt.file.readJSON('package.json');
          var bumpFiles = ["package.json", "bower.json", "composer.json"];
          var commitFiles = bumpFiles.concat(["./dist/*"]);
        Severity: Major
        Found in Gruntfile.js - About 1 day to fix

          File modernizr.js has 607 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*!
           * Modernizr v2.8.3
           * www.modernizr.com
           *
           * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton
          Severity: Major
          Found in dependencies/js/modernizr.js - About 1 day to fix

            Function _layout has 202 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        _layout: function() {
                            var positionPercentages;
                            var formattedValue;
            
                            if(this.options.reversed) {
            Severity: Major
            Found in src/js/bootstrap-slider.js - About 1 day to fix

              File Gruntfile.js has 309 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /*global module:false*/
              module.exports = function(grunt) {
              
                var packageJSON = grunt.file.readJSON('package.json');
                var bumpFiles = ["package.json", "bower.json", "composer.json"];
              Severity: Minor
              Found in Gruntfile.js - About 3 hrs to fix

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

                                                if (this.options.selection === 'after' && percentage >= positionPercentages[0]) {
                                                    this._addClass(this.tickLabels[i], 'label-in-selection');
                                                } else if (this.options.selection === 'before' && percentage <= positionPercentages[0]) {
                                                    this._addClass(this.tickLabels[i], 'label-in-selection');
                                                }
                Severity: Major
                Found in src/js/bootstrap-slider.js and 1 other location - About 3 hrs to fix
                src/js/bootstrap-slider.js on lines 1416..1420

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 103.

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

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

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

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

                Refactorings

                Further Reading

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

                                            if (this.options.selection === 'after' && percentage >= positionPercentages[0]){
                                                this._addClass(this.ticks[i], 'in-selection');
                                            } else if (this.options.selection === 'before' && percentage <= positionPercentages[0]) {
                                                this._addClass(this.ticks[i], 'in-selection');
                                            }
                Severity: Major
                Found in src/js/bootstrap-slider.js and 1 other location - About 3 hrs to fix
                src/js/bootstrap-slider.js on lines 1444..1448

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 103.

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

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

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

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

                Refactorings

                Further Reading

                Function _keydown has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            _keydown: function(handleIdx, ev) {
                                if(!this._state.enabled) {
                                    return false;
                                }
                
                
                Severity: Major
                Found in src/js/bootstrap-slider.js - About 2 hrs to fix

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

                        'generate-index-page' : {
                          options : {
                            data : {
                              js : {
                                highlightjs: '<%= pkg.gruntConfig.js.highlightjs %>',
                  Severity: Major
                  Found in Gruntfile.js and 1 other location - About 2 hrs to fix
                  Gruntfile.js on lines 150..171

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

                  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

                        'generate-gh-pages' : {
                          options : {
                            data : {
                              js : {
                                highlightjs: '<%= pkg.gruntConfig.js.ghpages.highlightjs %>',
                  Severity: Major
                  Found in Gruntfile.js and 1 other location - About 2 hrs to fix
                  Gruntfile.js on lines 128..149

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

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

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

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

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

                  Refactorings

                  Further Reading

                  Function defineBridget has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          function defineBridget( $ ) {
                  
                              // bail if no jQuery
                              if ( !$ ) {
                                  return;
                  Severity: Major
                  Found in src/js/bootstrap-slider.js - About 2 hrs to fix

                    Function setValue has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                setValue: function(val, triggerSlideEvent, triggerChangeEvent) {
                                    if (!val) {
                                        val = 0;
                                    }
                                    var oldValue = this.getValue();
                    Severity: Major
                    Found in src/js/bootstrap-slider.js - About 2 hrs to fix

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

                                  _removeSliderEventHandlers: function() {
                                      // Remove keydown event listeners
                                      this.handle1.removeEventListener("keydown", this.handle1Keydown, false);
                                      this.handle2.removeEventListener("keydown", this.handle2Keydown, false);
                      
                      
                      Severity: Major
                      Found in src/js/bootstrap-slider.js - About 2 hrs to fix

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

                                    _mousedown: function(ev) {
                                        if(!this._state.enabled) {
                                            return false;
                                        }
                        
                        
                        Severity: Minor
                        Found in src/js/bootstrap-slider.js - About 1 hr to fix

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

                                              this.trackHigh.style.width = (100 - Math.min(positionPercentages[0], positionPercentages[1]) - Math.abs(positionPercentages[0] - positionPercentages[1])) +'%';
                          Severity: Major
                          Found in src/js/bootstrap-slider.js and 1 other location - About 1 hr to fix
                          src/js/bootstrap-slider.js on lines 1494..1494

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                                              this.trackHigh.style.height = (100 - Math.min(positionPercentages[0], positionPercentages[1]) - Math.abs(positionPercentages[0] - positionPercentages[1])) +'%';
                          Severity: Major
                          Found in src/js/bootstrap-slider.js and 1 other location - About 1 hr to fix
                          src/js/bootstrap-slider.js on lines 1516..1516

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                                      function bridge( namespace, PluginClass ) {
                                        // add to jQuery fn namespace
                                        $.fn[ namespace ] = function( options ) {
                                          if ( typeof options === 'string' ) {
                                            // call plugin method when first argument is a string
                          Severity: Minor
                          Found in src/js/bootstrap-slider.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language