wikimedia/mediawiki-core

View on GitHub
resources/lib/jquery.ui/jquery.ui.slider.js

Summary

Maintainability
F
1 wk
Test Coverage

File jquery.ui.slider.js has 526 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * jQuery UI Slider 1.9.2
 * http://jqueryui.com
 *
 * Copyright 2012 jQuery Foundation and other contributors
Severity: Major
Found in resources/lib/jquery.ui/jquery.ui.slider.js - About 1 day to fix

    Function _create has 138 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _create: function() {
            var i, handleCount,
                o = this.options,
                existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
                handle = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",
    Severity: Major
    Found in resources/lib/jquery.ui/jquery.ui.slider.js - About 5 hrs to fix

      Function keydown has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  keydown: function( event ) {
                      var allowed, curVal, newVal, step,
                          index = $( event.target ).data( "ui-slider-handle-index" );
      
                      switch ( event.keyCode ) {
      Severity: Major
      Found in resources/lib/jquery.ui/jquery.ui.slider.js - About 2 hrs to fix

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

            _refreshValue: function() {
                var lastValPercent, valPercent, value, valueMin, valueMax,
                    oRange = this.options.range,
                    o = this.options,
                    that = this,
        Severity: Major
        Found in resources/lib/jquery.ui/jquery.ui.slider.js - About 2 hrs to fix

          Function _mouseCapture has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _mouseCapture: function( event ) {
                  var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
                      that = this,
                      o = this.options;
          
          
          Severity: Minor
          Found in resources/lib/jquery.ui/jquery.ui.slider.js - About 2 hrs to fix

            Function _setOption has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _setOption: function( key, value ) {
                    var i,
                        valsLength = 0;
            
                    if ( Array.isArray( this.options.values ) ) {
            Severity: Minor
            Found in resources/lib/jquery.ui/jquery.ui.slider.js - About 1 hr to fix

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

                  _slide: function( event, index, newVal ) {
                      var otherVal,
                          newValues,
                          allowed;
              
              
              Severity: Minor
              Found in resources/lib/jquery.ui/jquery.ui.slider.js - About 1 hr to fix

                Function values has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    values: function( index, newValue ) {
                        var vals,
                            newValues,
                            i;
                
                
                Severity: Minor
                Found in resources/lib/jquery.ui/jquery.ui.slider.js - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                              if ( ( this.options.values.length === 2 && this.options.range === true ) &&
                                      ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
                                  ) {
                                  newVal = otherVal;
                              }
                  Severity: Major
                  Found in resources/lib/jquery.ui/jquery.ui.slider.js - About 40 mins to fix

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

                                        } else {
                                            if ( i === 0 ) {
                                                that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
                                            }
                                            if ( i === 1 ) {
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.slider.js and 1 other location - About 4 hrs to fix
                    resources/lib/jquery.ui/jquery.ui.slider.js on lines 599..606

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 121.

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

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

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

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

                    Refactorings

                    Further Reading

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

                                        if ( that.orientation === "horizontal" ) {
                                            if ( i === 0 ) {
                                                that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
                                            }
                                            if ( i === 1 ) {
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.slider.js and 1 other location - About 4 hrs to fix
                    resources/lib/jquery.ui/jquery.ui.slider.js on lines 606..613

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 121.

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

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

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

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

                    Refactorings

                    Further Reading

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

                            if ( !this._keySliding && !this._mouseSliding ) {
                                var uiHash = {
                                    handle: this.handles[ index ],
                                    value: this.value()
                                };
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.slider.js and 1 other location - About 4 hrs to fix
                    resources/lib/jquery.ui/jquery.ui.slider.js on lines 398..409

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

                    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

                        _stop: function( event, index ) {
                            var uiHash = {
                                handle: this.handles[ index ],
                                value: this.value()
                            };
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.slider.js and 1 other location - About 4 hrs to fix
                    resources/lib/jquery.ui/jquery.ui.slider.js on lines 412..423

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

                    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 ( oRange === "max" && this.orientation === "horizontal" ) {
                                    this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
                                }
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.slider.js and 1 other location - About 1 hr to fix
                    resources/lib/jquery.ui/jquery.ui.slider.js on lines 636..638

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

                    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 ( oRange === "max" && this.orientation === "vertical" ) {
                                    this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
                                }
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.slider.js and 1 other location - About 1 hr to fix
                    resources/lib/jquery.ui/jquery.ui.slider.js on lines 630..632

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

                    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 ( oRange === "min" && this.orientation === "horizontal" ) {
                                    this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
                                }
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.slider.js and 1 other location - About 1 hr to fix
                    resources/lib/jquery.ui/jquery.ui.slider.js on lines 633..635

                    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

                                if ( oRange === "min" && this.orientation === "vertical" ) {
                                    this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
                                }
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.slider.js and 1 other location - About 1 hr to fix
                    resources/lib/jquery.ui/jquery.ui.slider.js on lines 627..629

                    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

                            if ( this.orientation === "horizontal" ) {
                                pixelTotal = this.elementSize.width;
                                pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
                            } else {
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.slider.js and 1 other location - About 1 hr to fix
                    resources/lib/jquery.ui/jquery.ui.slider.js on lines 322..325

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 63.

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

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

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

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

                    Refactorings

                    Further Reading

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

                            } else {
                                pixelTotal = this.elementSize.height;
                                pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
                            }
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.slider.js and 1 other location - About 1 hr to fix
                    resources/lib/jquery.ui/jquery.ui.slider.js on lines 319..322

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 63.

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

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

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

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

                    Refactorings

                    Further Reading

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

                                        case $.ui.keyCode.PAGE_UP:
                                            newVal = this._trimAlignValue( curVal + ( (this._valueMax() - this._valueMin()) / numPages ) );
                                            break;
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.slider.js and 1 other location - About 1 hr to fix
                    resources/lib/jquery.ui/jquery.ui.slider.js on lines 162..164

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

                    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

                                        case $.ui.keyCode.PAGE_DOWN:
                                            newVal = this._trimAlignValue( curVal - ( (this._valueMax() - this._valueMin()) / numPages ) );
                                            break;
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.slider.js and 1 other location - About 1 hr to fix
                    resources/lib/jquery.ui/jquery.ui.slider.js on lines 159..161

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

                    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

                                        case $.ui.keyCode.RIGHT:
                                            if ( curVal === this._valueMax() ) {
                                                return;
                                            }
                                            newVal = this._trimAlignValue( curVal + step );
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.slider.js and 1 other location - About 1 hr to fix
                    resources/lib/jquery.ui/jquery.ui.slider.js on lines 173..178

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

                    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

                                        case $.ui.keyCode.LEFT:
                                            if ( curVal === this._valueMin() ) {
                                                return;
                                            }
                                            newVal = this._trimAlignValue( curVal - step );
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.slider.js and 1 other location - About 1 hr to fix
                    resources/lib/jquery.ui/jquery.ui.slider.js on lines 166..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 55.

                    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