ophrescue/RescueRails

View on GitHub

Showing 159 of 254 total issues

Consider simplifying this complex logical expression.
Open

                                if (!0 !== c.static && void 0 === i.validPositions[u] && !0 !== c.optionality && !0 !== c.optionalQuantifier || !0 === c.static && e[u] !== n.getPlaceholder.call(t, u, c)) {
                                    r = !1;
                                    break;
                                }
Severity: Major
Found in app/assets/javascripts/jquery.inputmask.js - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

                        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(),
                        t = 0 - r.duplicate().moveStart("character", -e.inputmask._valueGet().length), a = t + r.text.length),
                        {
    Severity: Major
    Found in app/assets/javascripts/jquery.inputmask.js - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

                              if (e.scrollLeft = l > e.scrollWidth ? l : 0, e.inputmask.caretPos = {
                                  begin: t,
                                  end: a
                              }, s.insertModeVisual && !1 === s.insertMode && t === a && (n || a++), e === (e.inputmask.shadowRoot || e.ownerDocument).activeElement) if ("setSelectionRange" in e) e.setSelectionRange(t, a); else if (window.getSelection) {
                                  if (r = document.createRange(), void 0 === e.firstChild || null === e.firstChild) {
      Severity: Major
      Found in app/assets/javascripts/jquery.inputmask.js - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

                                            if (i.valHooks && (void 0 === i.valHooks[t] || !0 !== i.valHooks[t].inputmaskpatch)) {
                                                var n = i.valHooks[t] && i.valHooks[t].get ? i.valHooks[t].get : function(e) {
                                                    return e.value;
                                                }, s = i.valHooks[t] && i.valHooks[t].set ? i.valHooks[t].set : function(e, t) {
                                                    return e.value = t, e;
        Severity: Major
        Found in app/assets/javascripts/jquery.inputmask.js - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                              if (h.default) {
                                  if (!(this instanceof y)) return new y(e, t, a);
                                  this.dependencyLib = n.default, this.el = void 0, this.events = {}, this.maskset = void 0,
                                  !0 !== a && ("[object Object]" === Object.prototype.toString.call(e) ? t = e : (t = t || {},
                                  e && (t.alias = e)), this.opts = n.default.extend(!0, {}, this.defaults, t), this.noMasksCache = t && void 0 !== t.definitions,
          Severity: Major
          Found in app/assets/javascripts/jquery.inputmask.js - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                                    if (!s.isComplete.call(l, o.getBuffer.call(l)) && y.length <= E || s.isComplete.call(l, o.getBuffer.call(l)) && y.length > 0 && y.length !== E && 0 === y[0]) for (var S = E; void 0 !== (x = y.shift()); ) {
                                        var w = new d.Event("_checkval");
                                        if ((P = c.validPositions[x]).generatedInput = !0, w.which = P.input.charCodeAt(0),
                                        (g = u.EventHandlers.keypressEvent.call(l, w, !0, !1, a, S)) && void 0 !== g.pos && g.pos !== x && c.validPositions[g.pos] && !0 === c.validPositions[g.pos].match.static) y.push(g.pos); else if (!g) break;
                                        S++;
            Severity: Major
            Found in app/assets/javascripts/jquery.inputmask.js - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                                                  if (Object.getOwnPropertyDescriptor) {
                                                      var f = Object.getPrototypeOf ? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t), "value") : void 0;
                                                      f && f.get && f.set ? (n = f.get, l = f.set, Object.defineProperty(t, "value", {
                                                          get: u,
                                                          set: c,
              Severity: Major
              Found in app/assets/javascripts/jquery.inputmask.js - About 40 mins to fix

                Function getMaskTemplate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                                }), t.determineTestTemplate = o, t.getDecisionTaker = i, t.getMaskTemplate = function(e, t, a, i, s) {
                Severity: Minor
                Found in app/assets/javascripts/jquery.inputmask.js - About 35 mins to fix

                  Function d has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                                  function d(e, t, a, i, n) {
                  Severity: Minor
                  Found in app/assets/javascripts/jquery.inputmask.js - About 35 mins to fix

                    Function validator has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                                                    validator: function(e, t, a, i, n) {
                    Severity: Minor
                    Found in app/assets/javascripts/jquery.inputmask.js - About 35 mins to fix

                      Function caret has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                                      }), t.caret = function(e, t, a, i, n) {
                      Severity: Minor
                      Found in app/assets/javascripts/jquery.inputmask.js - About 35 mins to fix

                        Function keypressEvent has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                            keypressEvent: function(e, t, a, i, o) {
                        Severity: Minor
                        Found in app/assets/javascripts/jquery.inputmask.js - About 35 mins to fix

                          Function handleRemove has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                          t.handleRemove = function(e, t, a, i, s) {
                          Severity: Minor
                          Found in app/assets/javascripts/jquery.inputmask.js - About 35 mins to fix

                            Function validator has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                                            validator: function(e, t, a, i, n) {
                            Severity: Minor
                            Found in app/assets/javascripts/jquery.inputmask.js - About 35 mins to fix

                              Function p has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                              function p(e, t, a, i, n) {
                              Severity: Minor
                              Found in app/assets/javascripts/jquery.inputmask.js - About 35 mins to fix

                                Function p has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                                function p(e, t, a, i, r) {
                                Severity: Minor
                                Found in app/assets/javascripts/jquery.inputmask.js - About 35 mins to fix

                                  Function l has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                                  function l(e, t, a, i, n) {
                                  Severity: Minor
                                  Found in app/assets/javascripts/jquery.inputmask.js - About 35 mins to fix

                                    Method validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      def validate(record)
                                        return if record.postal_code.blank?
                                    
                                        country = ISO3166::Country.find_country_by_alpha3(record.country)
                                    
                                    
                                    Severity: Minor
                                    Found in app/validators/postal_code_validator.rb - About 35 mins to fix

                                    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 changes_to_sentence has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      def changes_to_sentence
                                        result = []
                                        changed_audit_attributes.each do |attr|
                                          if attr == 'assigned_to_user_id'
                                            new_value = user.present? ? user.name : 'No One'
                                    Severity: Minor
                                    Found in app/models/adopter.rb - About 35 mins to fix

                                    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 adopter_age has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      def adopter_age
                                        return unless birth_date
                                    
                                        today = Date.current
                                        age = today.year - birth_date.year
                                    Severity: Minor
                                    Found in app/models/adoption_app.rb - About 35 mins to fix

                                    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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language