Showing 159 of 254 total issues
Function m
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
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, {
constructor: {
Function caret
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
}), t.caret = function(e, t, a, i, n) {
var r, o = this, s = this.opts;
if (void 0 === t) return "selectionStart" in e && "selectionEnd" in e ? (t = e.selectionStart,
a = e.selectionEnd) : window.getSelection ? (r = window.getSelection().getRangeAt(0)).commonAncestorContainer.parentNode !== e && r.commonAncestorContainer !== e || (t = r.startOffset,
a = r.endOffset) : document.selection && document.selection.createRange && (r = document.selection.createRange(),
Method campaign_params
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def campaign_params
params.require(:campaign)
.permit(:title,
:summary,
:description,
Function mask
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
mask: function(e) {
e.repeat = 0, e.groupSeparator === e.radixPoint && e.digits && "0" !== e.digits && ("." === e.radixPoint ? e.groupSeparator = "," : "," === e.radixPoint ? e.groupSeparator = "." : e.groupSeparator = ""),
" " === e.groupSeparator && (e.skipOptionalPartCharacter = void 0), e.placeholder.length > 1 && (e.placeholder = e.placeholder.charAt(0)),
"radixFocus" === e.positionCaretOnClick && "" === e.placeholder && (e.positionCaretOnClick = "lvp");
var t = "0", a = e.radixPoint;
Method unset_permissions_on_locked_user
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def unset_permissions_on_locked_user
return if !locked?
update_columns(admin: false,
is_foster: false,
edit_dogs: false,
Method search
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def search
@adopters = Adopter
if @params[:search]
if email_search?
clean_email = @params[:search].strip
Function postValidation
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
postValidation: function(e, t, a, i, n, r, o, s) {
Consider simplifying this complex logical expression. Open
Open
if (this.el) {
n.default.data(this.el, k, null);
var e = this.opts.autoUnmask ? (0, c.unmaskedvalue)(this.el) : this._valueGet(this.opts.autoUnmask);
e !== l.getBufferTemplate.call(this).join("") ? this._valueSet(e, this.opts.autoUnmask) : this._valueSet(""),
f.EventRuler.off(this.el), Object.getOwnPropertyDescriptor && Object.getPrototypeOf ? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this.el), "value") && this.__valueGet && Object.defineProperty(this.el, "value", {
Consider simplifying this complex logical expression. Open
Open
if (a.min) {
if (e.rawyear) {
var r, o = e.rawyear.replace(/[^0-9]/g, ""), s = a.min.year.substr(0, o.length);
if (o < s) {
var l = P(t.pos, a);
Consider simplifying this complex logical expression. Open
Open
if (d && (!0 !== d.match.jit || "master" === d.match.newBlockMarker && (c = r.validPositions[l + 1]) && !0 === c.match.optionalQuantifier) && ((d = s.extend({}, d, {
input: n.getPlaceholder.call(i, l, d.match, !0) || d.match.def
})).generatedInput = !0, m.call(i, l, d, !0), !0 !== a)) {
var p = r.validPositions[t].input;
return r.validPositions[t] = void 0, f.call(i, t, p, !0, !0);
Function preValidation
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
preValidation: function(e, t, a, i, n, r, o, s) {
Consider simplifying this complex logical expression. Open
Open
if (e.length > 0 && t > 0 && (!a.digitsOptional || i)) {
var n = e.indexOf(a.radixPoint), r = !1;
a.negationSymbol.back === e[e.length - 1] && (r = !0, e.length--), -1 === n && (e.push(a.radixPoint),
n = e.length - 1);
for (var o = 1; o <= t; o++) isFinite(e[n + o]) || (e[n + o] = "0");
Consider simplifying this complex logical expression. Open
Open
if (0 === t.digits && -1 !== e.indexOf(a) && (e = e.substring(0, e.indexOf(a))),
null !== t.min || null !== t.max) {
var d = e.toString().replace(a, ".");
null !== t.min && d < t.min ? e = t.min.toString().replace(".", a) : null !== t.max && d > t.max && (e = t.max.toString().replace(".", a));
}
Consider simplifying this complex logical expression. Open
Open
if (r.inputmask) {
(0, l.HandleNativePlaceholder)(r, t.originalPlaceholder);
var o = r.inputmask._valueGet(), u = n.getBuffer.call(t).slice();
"" !== o && (a.clearMaskOnLostFocus && (-1 === n.getLastValidPosition.call(t) && o === n.getBufferTemplate.call(t).join("") ? u = [] : l.clearOptionalTail.call(t, u)),
!1 === s.isComplete.call(t, u) && (setTimeout((function() {
Function preValidation
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
preValidation: function(e, t, a, i, n, r, o, s) {
Consider simplifying this complex logical expression. Open
Open
if (p === r.default.BACKSPACE || p === r.default.DELETE || o.iphone && p === r.default.BACKSPACE_SAFARI || e.ctrlKey && p === r.default.X && !("oncut" in f)) e.preventDefault(),
s.handleRemove.call(t, f, p, h), (0, l.writeBuffer)(f, n.getBuffer.call(t, !0), c.p, e, f.inputmask._valueGet() !== n.getBuffer.call(t).join("")); else if (p === r.default.END || p === r.default.PAGE_DOWN) {
e.preventDefault();
var v = n.seekNext.call(t, n.getLastValidPosition.call(t));
n.caret.call(t, f, e.shiftKey ? h.begin : v, v, !0);
Consider simplifying this complex logical expression. Open
Open
if (@va.marketing_interest || @va.events_interest || @va.training_interest || @va.fundraising_interest || @va.transport_bb_interest || @va.adoption_team_interest || @va.admin_interest)
@notify.push('volunteer@ophrescue.org')
@notify.push('joanne@ophrescue.org')
end
Method search
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def search
@volunteer_apps = VolunteerApp
if text_search?
if email_search?
@volunteer_apps = @volunteer_apps.where('lower(email) LIKE ?', "%#{search_term}%")
- 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
Method create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def create
@donation = Donation.new donation_params.merge(card_token: stripe_params["stripeToken"])
raise "Check for errors" unless @donation.valid?
- 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 postValidation
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
postValidation: function(e, t, a, i, n, s, l) {