MiraitSystems/enju_trunk

View on GitHub
app/assets/javascripts/jquery.keypad.js

Summary

Maintainability
F
5 days
Test Coverage

File jquery.keypad.js has 721 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* http://keith-wood.name/keypad.html
   Keypad field entry extension for jQuery v1.4.2.
   Written by Keith Wood (kbwood{at}iinet.com.au) August 2008.
   Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and 
   MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses. 
Severity: Major
Found in app/assets/javascripts/jquery.keypad.js - About 1 day to fix

    Function Keypad has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function Keypad() {
        this._curInst = null; // The current instance in use
        this._disabledFields = []; // List of keypad fields that have been disabled
        this._keypadShowing = false; // True if the popup panel is showing , false if not
        this._keyCode = 0;
    Severity: Major
    Found in app/assets/javascripts/jquery.keypad.js - About 2 hrs to fix

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

          _randomiseLayout: function(inst) {
              var randomiseNumeric = this._get(inst, 'randomiseNumeric');
              var randomiseAlpha = this._get(inst, 'randomiseAlphabetic');
              var randomiseOther = this._get(inst, 'randomiseOther');
              var randomiseAll = this._get(inst, 'randomiseAll');
      Severity: Major
      Found in app/assets/javascripts/jquery.keypad.js - About 2 hrs to fix

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

            _showKeypad: function(field) {
                field = field.target || field;
                if ($.keypad._isDisabledKeypad(field) ||
                        $.keypad._lastField == field) { // already here
                    return;
        Severity: Major
        Found in app/assets/javascripts/jquery.keypad.js - About 2 hrs to fix

          Function _generateHTML has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _generateHTML: function(inst) {
                  var useTR = this._get(inst, 'useThemeRoller');
                  var isRTL = this._get(inst, 'isRTL');
                  var prompt = this._get(inst, 'prompt');
                  var separator = this._get(inst, 'separator');
          Severity: Minor
          Found in app/assets/javascripts/jquery.keypad.js - About 1 hr to fix

            Function _connectKeypad has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _connectKeypad: function(target, inst) {
                    var field = $(target);
                    if (field.hasClass(this.markerClassName)) {
                        return;
                    }
            Severity: Minor
            Found in app/assets/javascripts/jquery.keypad.js - About 1 hr to fix

              Function _disableKeypad has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  _disableKeypad: function(target) {
                      var control = $(target);
                      if (!control.hasClass(this.markerClassName)) {
                          return;
                      }
              Severity: Minor
              Found in app/assets/javascripts/jquery.keypad.js - About 1 hr to fix

                Function _checkOffset has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _checkOffset: function(inst, offset, isFixed) {
                        var pos = inst._input ? this._findPos(inst._input[0]) : null;
                        var browserWidth = window.innerWidth || document.documentElement.clientWidth;
                        var browserHeight = window.innerHeight || document.documentElement.clientHeight;
                        var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
                Severity: Minor
                Found in app/assets/javascripts/jquery.keypad.js - About 1 hr to fix

                  Function _hideKeypad has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      _hideKeypad: function(field, duration) {
                          var inst = this._curInst;
                          if (!inst || (field && inst != $.data(field, PROP_NAME))) {
                              return;
                          }
                  Severity: Minor
                  Found in app/assets/javascripts/jquery.keypad.js - About 1 hr to fix

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

                        insertValue: function(input, value) {
                            input = (input.jquery ? input : $(input));
                            var field = input[0];
                            var newValue = input.val();
                            var range = [newValue.length, newValue.length];
                    Severity: Minor
                    Found in app/assets/javascripts/jquery.keypad.js - About 1 hr to fix

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

                          _getIERange: function(field) {
                              field.focus();
                              var selectionRange = document.selection.createRange().duplicate();
                              // Use two ranges: before and selection
                              var beforeRange = this._getIETextRange(field);
                      Severity: Minor
                      Found in app/assets/javascripts/jquery.keypad.js - About 1 hr to fix

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

                                if (nodeName == 'input' || nodeName == 'textarea') {
                                target.disabled = true;
                                    control.siblings('button.' + this._triggerClass).
                                    each(function() { this.disabled = true; }).end().
                                    siblings('img.' + this._triggerClass).
                        Severity: Major
                        Found in app/assets/javascripts/jquery.keypad.js and 1 other location - About 3 hrs to fix
                        app/assets/javascripts/jquery.keypad.js on lines 253..264

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

                        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 (nodeName == 'input' || nodeName == 'textarea') {
                                    target.disabled = false;
                                    control.siblings('button.' + this._triggerClass).
                                        each(function() { this.disabled = false; }).end().
                                        siblings('img.' + this._triggerClass).
                        Severity: Major
                        Found in app/assets/javascripts/jquery.keypad.js and 1 other location - About 3 hrs to fix
                        app/assets/javascripts/jquery.keypad.js on lines 277..300

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

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

                                    inst._mainDiv.find('iframe.' + $.keypad._coverClass). // IE6- only
                                        css({left: -borders[0], top: -borders[1],
                                            width: inst._mainDiv.outerWidth(), height: inst._mainDiv.outerHeight()});
                        Severity: Major
                        Found in app/assets/javascripts/jquery.keypad.js and 1 other location - About 1 hr to fix
                        app/assets/javascripts/jquery.keypad.js on lines 404..407

                        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

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

                                inst._mainDiv.empty().append(this._generateHTML(inst)).
                                    find('iframe.' + this._coverClass). // IE6- only
                                    css({left: -borders[0], top: -borders[1],
                                        width: inst._mainDiv.outerWidth(), height: inst._mainDiv.outerHeight()});
                        Severity: Major
                        Found in app/assets/javascripts/jquery.keypad.js and 1 other location - About 1 hr to fix
                        app/assets/javascripts/jquery.keypad.js on lines 374..376

                        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

                                this._disabledFields = $.map(this._disabledFields,
                                    function(value) { return (value == target ? null : value); }); // delete entry
                        Severity: Minor
                        Found in app/assets/javascripts/jquery.keypad.js and 1 other location - About 30 mins to fix
                        app/assets/javascripts/jquery.keypad.js on lines 265..266

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

                        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._disabledFields = $.map(this._disabledFields,
                                    function(value) { return (value == target ? null : value); }); // delete entry
                        Severity: Minor
                        Found in app/assets/javascripts/jquery.keypad.js and 1 other location - About 30 mins to fix
                        app/assets/javascripts/jquery.keypad.js on lines 301..302

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

                        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