igorescobar/jQuery-Mask-Plugin

View on GitHub
src/jquery.mask.js

Summary

Maintainability
F
3 days
Test Coverage

Function Mask has 348 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var Mask = function (el, mask, options) {

        var p = {
            invalid: [],
            getCaret: function () {
Severity: Major
Found in src/jquery.mask.js - About 1 day to fix

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

    /**
     * jquery.mask.js
     * @version: v1.14.16
     * @author: Igor Escobar
     *
    Severity: Minor
    Found in src/jquery.mask.js - About 7 hrs to fix

      Function getMasked has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  getMasked: function(skipMaskChars, val) {
                      var buf = [],
                          value = val === undefined ? p.val() : val + '',
                          m = 0, maskLen = mask.length,
                          v = 0, valLen = value.length,
      Severity: Major
      Found in src/jquery.mask.js - About 3 hrs to fix

        Function calculateCaretPosition has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    calculateCaretPosition: function(oldVal) {
                        var newVal = p.getMasked(),
                            caretPosNew = p.getCaret();
                        if (oldVal !== newVal) {
                            var caretPosOld = el.data('mask-previus-caret-pos') || 0,
        Severity: Major
        Found in src/jquery.mask.js - About 2 hrs to fix

          Function events has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      events: function() {
                          el
                          .on('keydown.mask', function(e) {
                              el.data('mask-keycode', e.keyCode || e.which);
                              el.data('mask-previus-value', el.val());
          Severity: Minor
          Found in src/jquery.mask.js - About 1 hr to fix

            Function init has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                   jMask.init = function(onlyMask) {
                        onlyMask = onlyMask || false;
                        options = options || {};
            
                        jMask.clearIfNotMatch  = $.jMaskGlobals.clearIfNotMatch;
            Severity: Minor
            Found in src/jquery.mask.js - About 1 hr to fix

              Avoid deeply nested control flow statements.
              Open

                                              if (resetPos === -1) {
                                                  resetPos = m;
                                              } else if (m === lastMaskChar && m !== resetPos) {
                                                  m = resetPos - offset;
                                              }
              Severity: Major
              Found in src/jquery.mask.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                                if (lastMaskChar === resetPos) {
                                                    m -= offset;
                                                }
                Severity: Major
                Found in src/jquery.mask.js - About 45 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status