zammad/zammad

View on GitHub

Showing 4,422 of 4,422 total issues

Function initializeFieldDefinition has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const initializeFieldDefinition = (
  definition: FormKitTypeDefinition,
  additionalDefinitionOptions: Pick<
    FormKitTypeDefinition,
    'props' | 'features'
Severity: Minor
Found in app/frontend/shared/form/core/initializeFieldDefinition.ts - About 1 hr 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

Function onload has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        reader.onload = (function(_this) {
          return function(e) {
            var insert;
            insert = function(dataUrl, width) {
              var img, pos, range, result;
Severity: Minor
Found in public/assets/chat/chat-no-jquery.js - About 1 hr to fix

    Function onload has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                reader.onload = function(e) {
                  var img, insert, result;
                  result = e.target.result;
                  img = document.createElement('img');
                  img.src = result;
    Severity: Minor
    Found in public/assets/chat/chat.js - About 1 hr to fix

      Function open has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ZammadChat.prototype.open = function() {
            var remainerHeight;
            if (this.isOpen) {
              this.log.debug('widget already open, block');
              return;
      Severity: Minor
      Found in public/assets/chat/chat-no-jquery.js - About 1 hr to fix

        Function scrollPosIntoView has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function scrollPosIntoView(cm, pos, end, margin) {
            if (margin == null) { margin = 0; }
            var rect;
            if (!cm.options.lineWrapping && pos == end) {
              // Set pos and end to the cursor positions around the character pos sticks to
        Severity: Minor
        Found in app/assets/javascripts/app/lib/base/codemirror.js - About 1 hr to fix

          Function maxLengthOk has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            Plugin.prototype.maxLengthOk = function(typeAhead) {
              if ( !this.options.maxlength ) {
                return true
              }
              var length = this.$element.text().length
          Severity: Minor
          Found in app/assets/javascripts/app/lib/base/jquery.contenteditable.js - About 1 hr to fix

            Function onMouseDown has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function onMouseDown(e) {
                var cm = this, display = cm.display;
                if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }
                display.input.ensurePolled();
                display.shift = e.shiftKey;
            Severity: Minor
            Found in app/assets/javascripts/app/lib/base/codemirror.js - About 1 hr to fix

              Function objprop has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function objprop(type, value) {
                  if (type == "async") {
                    cx.marked = "property";
                    return cont(objprop);
                  } else if (type == "variable" || cx.style == "keyword") {
              Severity: Minor
              Found in app/assets/javascripts/app/lib/base/codemirror.js - About 1 hr to fix

                Function getDimensions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function getDimensions( elem ) {
                    var raw = elem[0];
                    if ( raw.nodeType === 9 ) {
                        return {
                            width: elem.width(),
                Severity: Minor
                Found in app/assets/javascripts/app/lib/core/jquery-ui-1.11.4.js - About 1 hr to fix

                  Function _setOption has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      _setOption: function( key, value ) {
                          if ( key === "active" ) {
                              // _activate() will handle invalid values and update this.options
                              this._activate( value );
                              return;
                  Severity: Minor
                  Found in app/assets/javascripts/app/lib/core/jquery-ui-1.11.4.js - About 1 hr to fix

                    Function top has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            top: function( position, data ) {
                                var within = data.within,
                                    withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
                                    outerHeight = data.within.height,
                                    collisionPosTop = position.top - data.collisionPosition.marginTop,
                    Severity: Minor
                    Found in app/assets/javascripts/app/lib/core/jquery-ui-1.11.4.js - About 1 hr to fix

                      Function style has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              style   : function() {
                                  $(this).css({
                                      position     : 'fixed',
                                      width        : '310px',
                                      height       : 'auto',
                      Severity: Minor
                      Found in app/assets/javascripts/app/lib/base/jquery.noty.js - About 1 hr to fix

                        Function left has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                left: function( position, data ) {
                                    var within = data.within,
                                        withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
                                        outerWidth = within.width,
                                        collisionPosLeft = position.left - data.collisionPosition.marginLeft,
                        Severity: Minor
                        Found in app/assets/javascripts/app/lib/core/jquery-ui-1.11.4.js - About 1 hr to fix

                          Method perform has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def perform(customer_id, updated_by_id)
                          
                              # check if update is needed
                              customer = User.lookup(id: customer_id)
                              return if !customer
                          Severity: Minor
                          Found in app/jobs/ticket_user_ticket_counter_job.rb - About 1 hr to fix

                            Function position has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                position: function() {
                                    if ( !this[ 0 ] ) {
                                        return;
                                    }
                            
                            
                            Severity: Minor
                            Found in app/assets/javascripts/app/lib/core/jquery-3.6.0.js - About 1 hr to fix

                              Function when has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  when: function( singleValue ) {
                                      var
                              
                                          // count of uncompleted subordinates
                                          remaining = arguments.length,
                              Severity: Minor
                              Found in app/assets/javascripts/app/lib/core/jquery-3.6.0.js - About 1 hr to fix

                                Function clone has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    clone: function( elem, dataAndEvents, deepDataAndEvents ) {
                                        var i, l, srcElements, destElements,
                                            clone = elem.cloneNode( true ),
                                            inPage = isAttached( elem );
                                
                                
                                Severity: Minor
                                Found in app/assets/javascripts/app/lib/core/jquery-3.6.0.js - About 1 hr to fix

                                  Function propFilter has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function propFilter( props, specialEasing ) {
                                      var index, name, easing, value, hooks;
                                  
                                      // camelCase, specialEasing and expand cssHook pass
                                      for ( index in props ) {
                                  Severity: Minor
                                  Found in app/assets/javascripts/app/lib/core/jquery-3.6.0.js - About 1 hr to fix

                                    Function addClass has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        addClass: function( value ) {
                                            var classes, elem, cur, curValue, clazz, j, finalValue,
                                                i = 0;
                                    
                                            if ( isFunction( value ) ) {
                                    Severity: Minor
                                    Found in app/assets/javascripts/app/lib/core/jquery-3.6.0.js - About 1 hr to fix

                                      Method search_index_reload has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          def search_index_reload(silent: false, worker: 0)
                                            tolerance       = 10
                                            tolerance_count = 0
                                            query           = reorder(created_at: :desc)
                                            total           = query.count
                                      Severity: Minor
                                      Found in app/models/concerns/has_search_index_backend.rb - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language