zammad/zammad

View on GitHub

Showing 2,064 of 4,422 total issues

Consider simplifying this complex logical expression.
Open

    if (!update.force &&
        update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
        (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
        display.renderedView == display.view && countDirtyView(cm) == 0)
      { return false }
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 (
        !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 !== 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 (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.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 ((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 (!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 ( 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 (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 validate_container_values has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def validate_container_values(container)
                            case container.class.to_s
                            when 'Array'
                              container.each_with_index do |value, index|
                                container[index] = value.class.to_s.in?(ALLOWED_DEFAULT_CLASSES) ? value : 'no such item'
                        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
                            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 check_restrict_values has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def check_restrict_values(perform_result)
                            changes.each_key do |key|
                              next if perform_result[:restrict_values][key].blank?
                              next if self[key].blank?
                              next if restricted_value?(perform_result, key)
                        Severity: Minor
                        Found in app/models/concerns/checks_core_workflow.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_filter_changes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def self.perform_filter_changes(mail, filter)
                            filter[:perform].each do |key, meta|
                              next if !Channel::EmailParser.check_attributes_by_x_headers(key, meta['value'])
                        
                              Rails.logger.debug { "  perform '#{key.downcase}' = '#{meta.inspect}'" }
                        Severity: Minor
                        Found in app/models/channel/filter/database.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