Showing 159 of 254 total issues
Consider simplifying this complex logical expression. Open
Open
if (o.length > 1 + ("" === o[o.length - 1].match.def ? 1 : 0)) for (var c = 0; c < o.length; c++) if ("" !== o[c].match.def && !0 !== o[c].match.optionality && !0 !== o[c].match.optionalQuantifier && (!0 === o[c].match.static || void 0 === r || !1 !== o[c].match.fn.test(r.match.def, n, e, !0, i)) && (l.push(o[c]),
!0 === o[c].match.static && (r = o[c]), l.length > 1 && /[0-9a-bA-Z]/.test(l[0].match.def))) return i.placeholder.charAt(e % i.placeholder.length);
Consider simplifying this complex logical expression. Open
Open
if (void 0 !== e && (e.inputmask._valueSet(t.join("")), void 0 === a || void 0 !== i && "blur" === i.type || o.caret.call(l, e, a, void 0, void 0, void 0 !== i && "keydown" === i.type && (i.keyCode === n.default.DELETE || i.keyCode === n.default.BACKSPACE)),
!0 === r)) {
var p = c(e), h = e.inputmask._valueGet();
e.inputmask.skipInputEvent = !0, p.trigger("input"), setTimeout((function() {
h === o.getBufferTemplate.call(l).join("") ? p.trigger("cleared") : !0 === s.isComplete.call(l, t) && p.trigger("complete");
Consider simplifying this complex logical expression. Open
Open
if (o.default && h && h.head && h.head.attachShadow && n.default.customElements && void 0 === n.default.customElements.get("input-mask")) {
var m = function(e) {
!function(e, t) {
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
e.prototype = Object.create(t && t.prototype, {
Consider simplifying this complex logical expression. Open
Open
if ((s.tests[e] || s.validPositions[e]) && (s.tests[e] || [ s.validPositions[e] ]).every((function(e, r) {
if (e.mloc[t]) return i = e, !1;
var o = void 0 !== a ? a : e.alternation, s = void 0 !== e.locator[o] ? e.locator[o].toString().indexOf(t) : -1;
return (void 0 === n || s < n) && -1 !== s && (i = e, n = s), !0;
})), i) {
Function on
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
on: function(e, t, a) {
var s = e.inputmask.dependencyLib, l = function(t) {
t.originalEvent && (t = t.originalEvent || t, arguments[0] = t);
var l, u = this, c = u.inputmask, f = c ? c.opts : void 0;
if (void 0 === c && "FORM" !== this.nodeName) {
Function m
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function m(e, t, a, i) {
var r = this, s = this.maskset, l = this.opts, u = this.dependencyLib;
function c(e, t, a) {
var i = t[e];
if (void 0 !== i && !0 === i.match.static && !0 !== i.match.optionality && (void 0 === t[0] || void 0 === t[0].alternation)) {
Method search
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def search
@adopters = Adopter
if @params[:search]
if email_search?
clean_email = @params[:search].strip
- Read upRead up
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 generateMaskSet
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
}), t.generateMaskSet = function(e, t) {
var a;
function n(e, a, n) {
var r, o, s = !1;
if (null !== e && "" !== e || ((s = null !== n.regex) ? e = (e = n.regex).replace(/^(\^)(.*)(\$)$/, "$2") : (s = !0,
Function mask
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
mask: function(e) {
var t = this;
return "string" == typeof e && (e = g.getElementById(e) || g.querySelectorAll(e)),
(e = e.nodeName ? [ e ] : Array.isArray(e) ? e : Array.from(e)).forEach((function(e, a) {
var s = n.default.extend(!0, {}, t.opts);
Function l
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var s = e.inputmask.dependencyLib, l = function(t) {
t.originalEvent && (t = t.originalEvent || t, arguments[0] = t);
var l, u = this, c = u.inputmask, f = c ? c.opts : void 0;
if (void 0 === c && "FORM" !== this.nodeName) {
var d = s.data(u, "_inputmask_opts");
Consider simplifying this complex logical expression. Open
Open
if (!(!0 === t || e.ctrlKey && e.altKey) && (e.ctrlKey || e.metaKey || u.ignorable)) return m === r.default.ENTER && u.undoValue !== u._valueGet(!0) && (u.undoValue = u._valueGet(!0),
setTimeout((function() {
h.trigger("change");
}), 0)), u.skipInputEvent = !0, !0;
Consider simplifying this complex logical expression. Open
Open
if ("" !== g && r.call(n)[h] !== g && !0 !== v.match.optionalQuantifier && !0 !== v.match.newBlockMarker || !s.call(n, h, c.keepStatic, !0) && v.match.def === g) {
var k = l.call(n, h);
(d >= k || d === h) && (h = k);
}
Consider simplifying this complex logical expression. Open
Open
if (o[s].match && (o[s].match.nativeDef === t.match[a.shiftPositions ? "def" : "nativeDef"] && (!a.shiftPositions || !t.match.static) || o[s].match.nativeDef === t.match.nativeDef || a.regex && !o[s].match.static && o[s].match.fn.test(t.input))) {
r = !0;
break;
}
Consider simplifying this complex logical expression. Open
Open
if (n += u(e.prefix, e), "" !== e.groupSeparator ? (void 0 === e.definitions[e.groupSeparator] && (e.definitions[e.groupSeparator] = {},
e.definitions[e.groupSeparator].validator = "[" + e.groupSeparator + "]", e.definitions[e.groupSeparator].placeholder = e.groupSeparator,
e.definitions[e.groupSeparator].static = !0, e.definitions[e.groupSeparator].generated = !0),
n += e._mask(e)) : n += "9{+}", void 0 !== e.digits && 0 !== e.digits) {
var o = e.digits.toString().split(",");
Consider simplifying this complex logical expression. Open
Open
if (i.fuzzy && (e = i.buffer, t = i.pos), (l = P(t, n)).targetMatch && l.targetMatch[0] && void 0 !== f[l.targetMatch[0]]) {
u = f[l.targetMatch[0]][0];
var d = e.slice(l.targetMatchIndex, l.targetMatchIndex + l.targetMatch[0].length);
!1 === new RegExp(u).test(d.join("")) && 2 === l.targetMatch[0].length && r.validPositions[l.targetMatchIndex] && r.validPositions[l.targetMatchIndex + 1] && (r.validPositions[l.targetMatchIndex + 1].input = "0");
}
Consider simplifying this complex logical expression. Open
Open
} else if (-1 !== s && (a.begin < s || a.end < s || e.keyCode === n.default.DELETE && a.begin === s)) return a.begin !== a.end || e.keyCode !== n.default.BACKSPACE && e.keyCode !== n.default.BACKSPACE_SAFARI || a.begin++,
(r = t.slice().reverse()).splice(r.length - a.begin, a.begin - a.end + 1), r = c(r, i.digits, i).join(""),
o.trigger("setvalue", [ r, a.begin >= r.length ? s + 1 : a.begin ]), !1;
Consider simplifying this complex logical expression. Open
Open
if (null !== e && "" !== e || ((s = null !== n.regex) ? e = (e = n.regex).replace(/^(\^)(.*)(\$)$/, "$2") : (s = !0,
e = ".*")), 1 === e.length && !1 === n.greedy && 0 !== n.repeat && (n.placeholder = ""),
n.repeat > 0 || "*" === n.repeat || "+" === n.repeat) {
var l = "*" === n.repeat ? 0 : "+" === n.repeat ? 1 : n.repeat;
e = n.groupmarker[0] + e + n.groupmarker[1] + n.quantifiermarker[0] + l + "," + n.repeat + n.quantifiermarker[1];
Consider simplifying this complex logical expression. Open
Open
if (y.jitOffset[x] && void 0 === y.validPositions[o.seekNext.call(v, x)] && !1 !== (S = f.call(v, x + y.jitOffset[x], t, !0, !0)) && (!0 !== r && (S.caret = x),
O = !0), e.end > x && (y.validPositions[x] = void 0), !O && !o.isMask.call(v, x, k.keepStatic && 0 === x)) for (var T = x + 1, A = o.seekNext.call(v, x, !1, 0 !== x); T <= A; T++) if (!1 !== (S = E(T, t, a))) {
S = h.call(v, x, void 0 !== S.pos ? S.pos : T) || S, x = T;
break;
}
Consider simplifying this complex logical expression. Open
Open
if (void 0 !== e.remove && (Array.isArray(e.remove) || (e.remove = [ e.remove ]),
e.remove.sort((function(e, t) {
return t.pos - e.pos;
})).forEach((function(e) {
m.call(v, {
Function l
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function l(e, t, a, i, r, s) {
var u, c, d, p, h, m, v, g, k, y, b, x = this, P = this.dependencyLib, E = this.opts, S = x.maskset, w = P.extend(!0, {}, S.validPositions), M = P.extend(!0, {}, S.tests), _ = !1, O = !1, T = void 0 !== r ? r : o.getLastValidPosition.call(x);
if (s && (y = s.begin, b = s.end, s.begin > s.end && (y = s.end, b = s.begin)),
-1 === T && void 0 === r) u = 0, c = (p = n.getTest.call(x, u)).alternation; else for (;T >= 0; T--) if ((d = S.validPositions[T]) && void 0 !== d.alternation) {
if (p && p.locator[d.alternation] !== d.locator[d.alternation]) break;