zammad/zammad

View on GitHub

Showing 2,063 of 4,240 total issues

Consider simplifying this complex logical expression.
Open

    if (gecko && !mac && !handled && code == 46 && e.shiftKey && !e.ctrlKey && document.execCommand)
      { document.execCommand("cut"); }
Severity: Major
Found in app/assets/javascripts/app/lib/base/codemirror.js - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

          if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
            var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)
            ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
                                                  span.to == null ? null : span.to - endCh));
          }
    Severity: Major
    Found in app/assets/javascripts/app/lib/base/codemirror.js - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

          if (style || startStyle || endStyle || mustWrap || css || attributes) {
            var fullStyle = style || "";
            if (startStyle) { fullStyle += startStyle; }
            if (endStyle) { fullStyle += endStyle; }
            var token = elt("span", [content], fullStyle, css);
      Severity: Major
      Found in app/assets/javascripts/app/lib/base/codemirror.js - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

              if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
                var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)
                ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));
              }
        Severity: Major
        Found in app/assets/javascripts/app/lib/base/codemirror.js - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                  if (isSupported && isDocumentHidden() && isString(title) && (options && (isString(options.icon) || isObject(options.icon))) && (permissionLevel() === PERMISSION_GRANTED)) {
                      notification = getNotification(title, options);
                  }
          Severity: Major
          Found in app/assets/javascripts/app/lib/base/desktop-notify.js - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                  if (this !== event.target &&
                    (jQuery.hotkeys.options.filterInputAcceptingElements &&
                      jQuery.hotkeys.textInputTypes.test(event.target.nodeName) ||
                      (jQuery.hotkeys.options.filterContentEditable && jQuery(event.target).attr('contenteditable')) ||
                      (jQuery.hotkeys.options.filterTextInputs &&
            Severity: Major
            Found in app/assets/javascripts/app/lib/base/jquery.hotkeys.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                if (
                  !result &&
                  opts.tablet &&
                  opts.featureDetect &&
                  navigator &&
              Severity: Major
              Found in app/assets/javascripts/app/lib/base/is-mobile.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                        if ((this.showMeridian && name === 'meridian') || (this.showSeconds && name === 'second') || (!this.showMeridian && !this.showSeconds && name === 'minute')) {
                          return this.hideWidget();
                        }
                Severity: Major
                Found in app/assets/javascripts/app/lib/bootstrap/bootstrap-timepicker.js - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if ( this.options.tolerance === "pointer" ||
                              this.options.forcePointerForContainers ||
                              (this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"])
                          ) {
                              return isOverElement;
                  Severity: Major
                  Found in app/assets/javascripts/app/lib/core/jquery-ui-1.11.4.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                        if ( support.matchesSelector && documentIsHTML &&
                            !nonnativeSelectorCache[ expr + " " ] &&
                            ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
                            ( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
                    
                    
                    Severity: Major
                    Found in app/assets/javascripts/app/lib/core/jquery-3.6.0.js - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if ((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || (_isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
                                  $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
                                      if (that._trigger("stop", event) !== false) {
                                          that._clear();
                                      }
                      Severity: Major
                      Found in app/assets/javascripts/app/lib/core/jquery-ui-1.11.4.js - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                    if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
                                        (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
                                    }
                        Severity: Major
                        Found in app/assets/javascripts/app/lib/core/jquery-ui-1.11.4.js - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor &&
                                                         _.isFunction(bCtor) && bCtor instanceof bCtor)
                                                    && ('constructor' in a && 'constructor' in b)) {
                                  return false;
                                }
                          Severity: Major
                          Found in app/assets/javascripts/app/lib/core/underscore-1.8.3.js - About 1 hr to fix

                            Consider simplifying this complex logical expression.
                            Open

                                if (
                                  schemaData.fields.sslVerify === undefined ||
                                  schemaData.fields.sslVerify === null ||
                                  (execution === FormHandlerExecution.FieldChange &&
                                    (!changedField || changedField.name !== 'sslVerify')) ||

                              Function isMobile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function isMobile (opts) {
                                if (!opts) opts = {}
                                let ua = opts.ua
                                if (!ua && typeof navigator !== 'undefined') ua = navigator.userAgent
                                if (ua && ua.headers && typeof ua.headers['user-agent'] === 'string') {
                              Severity: Minor
                              Found in app/assets/javascripts/app/lib/base/is-mobile.js - About 55 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 state_color_code has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def state_color_code
                                    if %w[new open].include?(state_type_name)
                                      return ticket_is_escalating? ? 'escalating' : 'open'
                                    elsif state_type_name == 'pending reminder'
                                      return ticket_is_over_pending_time? ? 'open' : 'pending'
                              Severity: Minor
                              Found in app/graphql/gql/types/ticket_type.rb - About 55 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 perform has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def perform
                                  Channel.where(area: ['Google::Account', 'Microsoft365::Account']).find_each do |channel|
                                    next if channel.options.blank?
                                    next if channel.options[:backup_imap_classic].blank?
                                    next if channel.options[:backup_imap_classic][:migrated_at] > 7.days.ago
                              Severity: Minor
                              Found in app/jobs/imap_authentication_migration_cleanup_job.rb - About 55 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 validate_methods! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def validate_methods!(methods, reference, display)
                                  return "\#{#{display} / missing method}" if methods.blank?
                              
                                  methods.each_with_index do |method, index|
                                    display = "#{display}.#{method}"
                              Severity: Minor
                              Found in app/jobs/trigger_webhook_job/custom_payload/validator.rb - About 55 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 perform has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def perform(article_id)
                                  article = Ticket::Article.find(article_id)
                              
                                  # set retry count
                                  article.preferences['delivery_retry'] ||= 0
                              Severity: Minor
                              Found in app/jobs/communicate_facebook_job.rb - About 55 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 get_nonplaintext_body_as_attachment has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def get_nonplaintext_body_as_attachment(mail)
                                  if !(mail.html_part&.body.present? || (!mail.multipart? && mail.mime_type.present? && mail.mime_type != 'text/plain'))
                                    return
                                  end
                              
                              
                              Severity: Minor
                              Found in app/models/channel/email_parser.rb - About 55 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