sharetribe/sharetribe

View on GitHub
app/assets/javascripts/admin2/sortable.js

Summary

Maintainability
F
3 wks
Test Coverage

File sortable.js has 2871 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**!
 * Sortable 1.10.2
 * @author    RubaXa   <trash@rubaxa.org>
 * @author    owenm    <owen23355@gmail.com>
 * @license MIT
Severity: Major
Found in app/assets/javascripts/admin2/sortable.js - About 1 wk to fix

    Function MultiDragPlugin has 463 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function MultiDragPlugin() {
        function MultiDrag(sortable) {
          // Bind all private methods
          for (var fn in this) {
            if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
    Severity: Major
    Found in app/assets/javascripts/admin2/sortable.js - About 2 days to fix

      Function _onDragOver has 201 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _onDragOver: function _onDragOver(
          /**Event*/
          evt) {
            var el = this.el,
                target = evt.target,
      Severity: Major
      Found in app/assets/javascripts/admin2/sortable.js - About 1 day to fix

        Function _onDrop has 122 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _onDrop: function _onDrop(
            /**Event*/
            evt) {
              var el = this.el,
                  options = this.options; // Get the index of the dragged element within its parent
        Severity: Major
        Found in app/assets/javascripts/admin2/sortable.js - About 4 hrs to fix

          Function drop has 121 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                drop: function drop(_ref12) {
                  var evt = _ref12.originalEvent,
                      rootEl = _ref12.rootEl,
                      parentEl = _ref12.parentEl,
                      sortable = _ref12.sortable,
          Severity: Major
          Found in app/assets/javascripts/admin2/sortable.js - About 4 hrs to fix

            Function AnimationStateManager has 119 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function AnimationStateManager() {
                var animationStates = [],
                    animationCallbackId;
                return {
                  captureAnimationState: function captureAnimationState() {
            Severity: Major
            Found in app/assets/javascripts/admin2/sortable.js - About 4 hrs to fix

              Function AutoScrollPlugin has 88 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function AutoScrollPlugin() {
                  function AutoScroll() {
                    this.defaults = {
                      scroll: true,
                      scrollSensitivity: 30,
              Severity: Major
              Found in app/assets/javascripts/admin2/sortable.js - About 3 hrs to fix

                Function autoScroll has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  var autoScroll = throttle(function (evt, options, rootEl, isFallback) {
                    // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
                    if (!options.scroll) return;
                    var x = (evt.touches ? evt.touches[0] : evt).clientX,
                        y = (evt.touches ? evt.touches[0] : evt).clientY,
                Severity: Major
                Found in app/assets/javascripts/admin2/sortable.js - About 3 hrs to fix

                  Function _prepareDragStart has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      _prepareDragStart: function _prepareDragStart(
                      /** Event */
                      evt,
                      /** Touch */
                      touch,
                  Severity: Major
                  Found in app/assets/javascripts/admin2/sortable.js - About 3 hrs to fix

                    Consider simplifying this complex logical expression.
                    Open

                          if (tapEvt) {
                            var options = this.options,
                                fallbackTolerance = options.fallbackTolerance,
                                fallbackOffset = options.fallbackOffset,
                                touch = evt.touches ? evt.touches[0] : evt,
                    Severity: Critical
                    Found in app/assets/javascripts/admin2/sortable.js - About 3 hrs to fix

                      Function Sortable has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        function Sortable(el, options) {
                          if (!(el && el.nodeType && el.nodeType === 1)) {
                            throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el));
                          }
                      
                      
                      Severity: Major
                      Found in app/assets/javascripts/admin2/sortable.js - About 3 hrs to fix

                        Function _onTapStart has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            _onTapStart: function _onTapStart(
                            /** Event|TouchEvent */
                            evt) {
                              if (!evt.cancelable) return;
                        
                        
                        Severity: Major
                        Found in app/assets/javascripts/admin2/sortable.js - About 2 hrs to fix

                          Function SwapPlugin has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            function SwapPlugin() {
                              function Swap() {
                                this.defaults = {
                                  swapClass: 'sortable-swap-highlight'
                                };
                          Severity: Major
                          Found in app/assets/javascripts/admin2/sortable.js - About 2 hrs to fix

                            Function animateAll has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  animateAll: function animateAll(callback) {
                                    var _this = this;
                            
                                    if (!this.options.animation) {
                                      clearTimeout(animationCallbackId);
                            Severity: Major
                            Found in app/assets/javascripts/admin2/sortable.js - About 2 hrs to fix

                              Consider simplifying this complex logical expression.
                              Open

                                    if (el === winScroller) {
                                      canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');
                                      canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');
                                    } else {
                                      canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');
                              Severity: Critical
                              Found in app/assets/javascripts/admin2/sortable.js - About 2 hrs to fix

                                Function getRect has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {
                                    if (!el.getBoundingClientRect && el !== window) return;
                                    var elRect, top, left, bottom, right, height, width;
                                
                                    if (el !== window && el !== getWindowScrollingElement()) {
                                Severity: Major
                                Found in app/assets/javascripts/admin2/sortable.js - About 2 hrs to fix

                                  Function _onDragStart has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      _onDragStart: function _onDragStart(
                                      /**Event*/
                                      evt,
                                      /**boolean*/
                                      fallback) {
                                  Severity: Major
                                  Found in app/assets/javascripts/admin2/sortable.js - About 2 hrs to fix

                                    Function dispatchEvent has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      function dispatchEvent(_ref) {
                                        var sortable = _ref.sortable,
                                            rootEl = _ref.rootEl,
                                            name = _ref.name,
                                            targetEl = _ref.targetEl,
                                    Severity: Minor
                                    Found in app/assets/javascripts/admin2/sortable.js - About 1 hr to fix

                                      Function dragOverCompleted has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                            dragOverCompleted: function dragOverCompleted(_ref10) {
                                              var sortable = _ref10.sortable,
                                                  isOwner = _ref10.isOwner,
                                                  insertion = _ref10.insertion,
                                                  activeSortable = _ref10.activeSortable,
                                      Severity: Minor
                                      Found in app/assets/javascripts/admin2/sortable.js - About 1 hr to fix

                                        Function _onTouchMove has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            _onTouchMove: function _onTouchMove(
                                            /**TouchEvent*/
                                            evt) {
                                              if (tapEvt) {
                                                var options = this.options,
                                        Severity: Minor
                                        Found in app/assets/javascripts/admin2/sortable.js - About 1 hr to fix

                                          Function completed has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                                function completed(insertion) {
                                                  dragOverEvent('dragOverCompleted', {
                                                    insertion: insertion
                                                  });
                                          
                                          
                                          Severity: Minor
                                          Found in app/assets/javascripts/admin2/sortable.js - About 1 hr to fix

                                            Function _appendGhost has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                _appendGhost: function _appendGhost() {
                                                  // Bug if using scale(): https://stackoverflow.com/questions/2637058
                                                  // Not being adjusted for
                                                  if (!ghostEl) {
                                                    var container = this.options.fallbackOnBody ? document.body : rootEl,
                                            Severity: Minor
                                            Found in app/assets/javascripts/admin2/sortable.js - About 1 hr to fix

                                              Function pluginEvent has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                var pluginEvent = function pluginEvent(eventName, sortable) {
                                                  var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
                                                      originalEvent = _ref.evt,
                                                      data = _objectWithoutProperties(_ref, ["evt"]);
                                              
                                              
                                              Severity: Minor
                                              Found in app/assets/javascripts/admin2/sortable.js - About 1 hr to fix

                                                Function _emulateDragOver has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                    _emulateDragOver: function _emulateDragOver() {
                                                      if (touchEvt) {
                                                        this._lastX = touchEvt.clientX;
                                                        this._lastY = touchEvt.clientY;
                                                
                                                
                                                Severity: Minor
                                                Found in app/assets/javascripts/admin2/sortable.js - About 1 hr to fix

                                                  Function _getSwapDirection has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                    function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
                                                      var mouseOnAxis = vertical ? evt.clientY : evt.clientX,
                                                          targetLength = vertical ? targetRect.height : targetRect.width,
                                                          targetS1 = vertical ? targetRect.top : targetRect.left,
                                                          targetS2 = vertical ? targetRect.bottom : targetRect.right,
                                                  Severity: Minor
                                                  Found in app/assets/javascripts/admin2/sortable.js - About 1 hr to fix

                                                    Function dragStarted has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                          dragStarted: function dragStarted(_ref7) {
                                                            var _this2 = this;
                                                    
                                                            var sortable = _ref7.sortable;
                                                            if (!this.isMultiDrag) return;
                                                    Severity: Minor
                                                    Found in app/assets/javascripts/admin2/sortable.js - About 1 hr to fix

                                                      Function _prepareGroup has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                            _prepareGroup = function _prepareGroup(options) {
                                                          function toFn(value, pull) {
                                                            return function (to, from, dragEl, evt) {
                                                              var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
                                                      
                                                      
                                                      Severity: Minor
                                                      Found in app/assets/javascripts/admin2/sortable.js - About 1 hr to fix

                                                        Function _handleAutoScroll has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                        Open

                                                              _handleAutoScroll: function _handleAutoScroll(evt, fallback) {
                                                                var _this = this;
                                                        
                                                                var x = (evt.touches ? evt.touches[0] : evt).clientX,
                                                                    y = (evt.touches ? evt.touches[0] : evt).clientY,
                                                        Severity: Minor
                                                        Found in app/assets/javascripts/admin2/sortable.js - About 1 hr to fix

                                                          Function MultiDrag has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                          Open

                                                              function MultiDrag(sortable) {
                                                                // Bind all private methods
                                                                for (var fn in this) {
                                                                  if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
                                                                    this[fn] = this[fn].bind(this);
                                                          Severity: Minor
                                                          Found in app/assets/javascripts/admin2/sortable.js - About 1 hr to fix

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

                                                                  eventProperties: function eventProperties() {
                                                                    var _this3 = this;
                                                            
                                                                    var oldIndicies = [],
                                                                        newIndicies = [];
                                                            Severity: Minor
                                                            Found in app/assets/javascripts/admin2/sortable.js - About 1 hr to fix

                                                              Function _onMove has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                                              Open

                                                                function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {
                                                                  var evt,
                                                                      sortable = fromEl[expando],
                                                                      onMoveFn = sortable.options.onMove,
                                                                      retVal; // Support for new CustomEvent feature
                                                              Severity: Minor
                                                              Found in app/assets/javascripts/admin2/sortable.js - About 1 hr to fix

                                                                Function _onMove has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                                                Open

                                                                  function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {
                                                                Severity: Major
                                                                Found in app/assets/javascripts/admin2/sortable.js - About 1 hr to fix

                                                                  Consider simplifying this complex logical expression.
                                                                  Open

                                                                          if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {
                                                                            if (Sortable.eventCanceled) {
                                                                              this._onDrop();
                                                                  
                                                                              return;
                                                                  Severity: Major
                                                                  Found in app/assets/javascripts/admin2/sortable.js - About 1 hr to fix

                                                                    Consider simplifying this complex logical expression.
                                                                    Open

                                                                          if (target && !dragEl && target.parentNode === el) {
                                                                            var dragRect = getRect(target);
                                                                            rootEl = el;
                                                                            dragEl = target;
                                                                            parentEl = dragEl.parentNode;
                                                                    Severity: Major
                                                                    Found in app/assets/javascripts/admin2/sortable.js - About 1 hr to fix

                                                                      Function _getSwapDirection has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                                                      Open

                                                                        function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
                                                                      Severity: Major
                                                                      Found in app/assets/javascripts/admin2/sortable.js - About 1 hr to fix

                                                                        Avoid deeply nested control flow statements.
                                                                        Open

                                                                                    if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {
                                                                                      targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);
                                                                                    }
                                                                        Severity: Major
                                                                        Found in app/assets/javascripts/admin2/sortable.js - About 45 mins to fix

                                                                          Avoid deeply nested control flow statements.
                                                                          Open

                                                                                          if (currentIndex > lastIndex) {
                                                                                            i = lastIndex;
                                                                                            n = currentIndex;
                                                                                          } else {
                                                                                            i = currentIndex;
                                                                          Severity: Major
                                                                          Found in app/assets/javascripts/admin2/sortable.js - About 45 mins to fix

                                                                            Avoid deeply nested control flow statements.
                                                                            Open

                                                                                            if (update) {
                                                                                              dispatchSortableEvent('update');
                                                                                            }
                                                                            Severity: Major
                                                                            Found in app/assets/javascripts/admin2/sortable.js - About 45 mins to fix

                                                                              Avoid deeply nested control flow statements.
                                                                              Open

                                                                                          if (scrolledPastTop) {
                                                                                            scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);
                                                                                          }
                                                                              Severity: Major
                                                                              Found in app/assets/javascripts/admin2/sortable.js - About 45 mins to fix

                                                                                Avoid deeply nested control flow statements.
                                                                                Open

                                                                                                for (; i < n; i++) {
                                                                                                  if (~multiDragElements.indexOf(children[i])) continue;
                                                                                                  toggleClass(children[i], options.selectedClass, true);
                                                                                                  multiDragElements.push(children[i]);
                                                                                                  dispatchEvent({
                                                                                Severity: Major
                                                                                Found in app/assets/javascripts/admin2/sortable.js - About 45 mins to fix

                                                                                  Avoid deeply nested control flow statements.
                                                                                  Open

                                                                                                if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {
                                                                                                  return;
                                                                                                }
                                                                                  Severity: Major
                                                                                  Found in app/assets/javascripts/admin2/sortable.js - About 45 mins to fix

                                                                                    Avoid deeply nested control flow statements.
                                                                                    Open

                                                                                                do {
                                                                                                  dragIndex -= direction;
                                                                                                  sibling = parentEl.children[dragIndex];
                                                                                                } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));
                                                                                    Severity: Major
                                                                                    Found in app/assets/javascripts/admin2/sortable.js - About 45 mins to fix

                                                                                      Avoid deeply nested control flow statements.
                                                                                      Open

                                                                                                    if (inserted && !this.options.dragoverBubble) {
                                                                                                      break;
                                                                                                    }
                                                                                      Severity: Major
                                                                                      Found in app/assets/javascripts/admin2/sortable.js - About 45 mins to fix

                                                                                        Avoid deeply nested control flow statements.
                                                                                        Open

                                                                                                      if (newIndex >= 0) {
                                                                                                        // drag & drop within the same list
                                                                                                        _dispatchEvent({
                                                                                                          sortable: this,
                                                                                                          name: 'update',
                                                                                        Severity: Major
                                                                                        Found in app/assets/javascripts/admin2/sortable.js - About 45 mins to fix

                                                                                          Avoid deeply nested control flow statements.
                                                                                          Open

                                                                                                            if (multiDragElement.sortableIndex !== index(multiDragElement)) {
                                                                                                              update = true;
                                                                                                              return;
                                                                                                            }
                                                                                          Severity: Major
                                                                                          Found in app/assets/javascripts/admin2/sortable.js - About 45 mins to fix

                                                                                            Avoid deeply nested control flow statements.
                                                                                            Open

                                                                                                              if (multiDragElement !== dragEl$1) {
                                                                                                                var rect = folding ? getRect(multiDragElement) : dragRect;
                                                                                                                multiDragElement.fromRect = rect; // Prepare unfold animation
                                                                                            
                                                                                                                toSortable.addAnimationState({
                                                                                            Severity: Major
                                                                                            Found in app/assets/javascripts/admin2/sortable.js - About 45 mins to fix

                                                                                              Avoid deeply nested control flow statements.
                                                                                              Open

                                                                                                          if (moveVector === 1 || moveVector === -1) {
                                                                                                            after = moveVector === 1;
                                                                                                          }
                                                                                              Severity: Major
                                                                                              Found in app/assets/javascripts/admin2/sortable.js - About 45 mins to fix

                                                                                                Avoid deeply nested control flow statements.
                                                                                                Open

                                                                                                            if (after && !nextSibling) {
                                                                                                              el.appendChild(dragEl);
                                                                                                            } else {
                                                                                                              target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
                                                                                                            } // Undo chrome's scroll adjustment (has no effect on other browsers)
                                                                                                Severity: Major
                                                                                                Found in app/assets/javascripts/admin2/sortable.js - About 45 mins to fix

                                                                                                  Consider simplifying this complex logical expression.
                                                                                                  Open

                                                                                                          } else if (target.parentNode === el) {
                                                                                                            targetRect = getRect(target);
                                                                                                            var direction = 0,
                                                                                                                targetBeforeFirstSwap,
                                                                                                                differentLevel = dragEl.parentNode !== el,
                                                                                                  Severity: Major
                                                                                                  Found in app/assets/javascripts/admin2/sortable.js - About 40 mins to fix

                                                                                                    Consider simplifying this complex logical expression.
                                                                                                    Open

                                                                                                              if (options.animation && multiDragElements.length > 1 && (folding || !isOwner && !activeSortable.options.sort && !putSortable)) {
                                                                                                                // Fold: Set all multi drag elements's rects to dragEl's rect when multi-drag elements are invisible
                                                                                                                var dragRectAbsolute = getRect(dragEl$1, false, true, true);
                                                                                                                multiDragElements.forEach(function (multiDragElement) {
                                                                                                                  if (multiDragElement === dragEl$1) return;
                                                                                                    Severity: Major
                                                                                                    Found in app/assets/javascripts/admin2/sortable.js - About 40 mins to fix

                                                                                                      Consider simplifying this complex logical expression.
                                                                                                      Open

                                                                                                              if (duration) {
                                                                                                                css(target, 'transition', '');
                                                                                                                css(target, 'transform', '');
                                                                                                                var elMatrix = matrix(this.el),
                                                                                                                    scaleX = elMatrix && elMatrix.a,
                                                                                                      Severity: Major
                                                                                                      Found in app/assets/javascripts/admin2/sortable.js - About 40 mins to fix

                                                                                                        Consider simplifying this complex logical expression.
                                                                                                        Open

                                                                                                              if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
                                                                                                              : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {
                                                                                                                vertical = this._getDirection(evt, target) === 'vertical';
                                                                                                                dragRect = getRect(dragEl);
                                                                                                                dragOverEvent('dragOverValid');
                                                                                                        Severity: Major
                                                                                                        Found in app/assets/javascripts/admin2/sortable.js - About 40 mins to fix

                                                                                                          Consider simplifying this complex logical expression.
                                                                                                          Open

                                                                                                                  if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {
                                                                                                                    if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();
                                                                                                                    if (gotSelf || includeSelf) return elem;
                                                                                                                    gotSelf = true;
                                                                                                                  }
                                                                                                          Severity: Major
                                                                                                          Found in app/assets/javascripts/admin2/sortable.js - About 40 mins to fix

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

                                                                                                              function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {
                                                                                                            Severity: Minor
                                                                                                            Found in app/assets/javascripts/admin2/sortable.js - About 35 mins to fix

                                                                                                              Avoid too many return statements within this function.
                                                                                                              Open

                                                                                                                        return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
                                                                                                              Severity: Major
                                                                                                              Found in app/assets/javascripts/admin2/sortable.js - About 30 mins to fix

                                                                                                                Avoid too many return statements within this function.
                                                                                                                Open

                                                                                                                    return false;
                                                                                                                Severity: Major
                                                                                                                Found in app/assets/javascripts/admin2/sortable.js - About 30 mins to fix

                                                                                                                  Avoid too many return statements within this function.
                                                                                                                  Open

                                                                                                                          return;
                                                                                                                  Severity: Major
                                                                                                                  Found in app/assets/javascripts/admin2/sortable.js - About 30 mins to fix

                                                                                                                    Avoid too many return statements within this function.
                                                                                                                    Open

                                                                                                                                return completed(false);
                                                                                                                    Severity: Major
                                                                                                                    Found in app/assets/javascripts/admin2/sortable.js - About 30 mins to fix

                                                                                                                      Avoid too many return statements within this function.
                                                                                                                      Open

                                                                                                                              return;
                                                                                                                      Severity: Major
                                                                                                                      Found in app/assets/javascripts/admin2/sortable.js - About 30 mins to fix

                                                                                                                        Avoid too many return statements within this function.
                                                                                                                        Open

                                                                                                                                    return completed(true);
                                                                                                                        Severity: Major
                                                                                                                        Found in app/assets/javascripts/admin2/sortable.js - About 30 mins to fix

                                                                                                                          Avoid too many return statements within this function.
                                                                                                                          Open

                                                                                                                                    return; // cancel dnd
                                                                                                                          Severity: Major
                                                                                                                          Found in app/assets/javascripts/admin2/sortable.js - About 30 mins to fix

                                                                                                                            Avoid too many return statements within this function.
                                                                                                                            Open

                                                                                                                                      return completed(false);
                                                                                                                            Severity: Major
                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js - About 30 mins to fix

                                                                                                                              Avoid too many return statements within this function.
                                                                                                                              Open

                                                                                                                                      return;
                                                                                                                              Severity: Major
                                                                                                                              Found in app/assets/javascripts/admin2/sortable.js - About 30 mins to fix

                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                Open

                                                                                                                                          return completed(true);
                                                                                                                                Severity: Major
                                                                                                                                Found in app/assets/javascripts/admin2/sortable.js - About 30 mins to fix

                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                  Open

                                                                                                                                            return; // cancel dnd
                                                                                                                                  Severity: Major
                                                                                                                                  Found in app/assets/javascripts/admin2/sortable.js - About 30 mins to fix

                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                    Open

                                                                                                                                                return completed(true);
                                                                                                                                    Severity: Major
                                                                                                                                    Found in app/assets/javascripts/admin2/sortable.js - About 30 mins to fix

                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                      Open

                                                                                                                                              return false;
                                                                                                                                      Severity: Major
                                                                                                                                      Found in app/assets/javascripts/admin2/sortable.js - About 30 mins to fix

                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                        Open

                                                                                                                                                    return completed(false);
                                                                                                                                        Severity: Major
                                                                                                                                        Found in app/assets/javascripts/admin2/sortable.js - About 30 mins to fix

                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                          Open

                                                                                                                                                return false;
                                                                                                                                          Severity: Major
                                                                                                                                          Found in app/assets/javascripts/admin2/sortable.js - About 30 mins to fix

                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                            Open

                                                                                                                                              function insertMultiDragElements(clonesInserted, rootEl) {
                                                                                                                                                multiDragElements.forEach(function (multiDragElement, i) {
                                                                                                                                                  var target = rootEl.children[multiDragElement.sortableIndex + (clonesInserted ? Number(i) : 0)];
                                                                                                                                            
                                                                                                                                                  if (target) {
                                                                                                                                            Severity: Major
                                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js and 1 other location - About 2 hrs to fix
                                                                                                                                            app/assets/javascripts/admin2/sortable.js on lines 3682..3692

                                                                                                                                            Duplicated Code

                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                            Tuning

                                                                                                                                            This issue has a mass of 89.

                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                            Refactorings

                                                                                                                                            Further Reading

                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                            Open

                                                                                                                                              function insertMultiDragClones(elementsInserted, rootEl) {
                                                                                                                                                multiDragClones.forEach(function (clone, i) {
                                                                                                                                                  var target = rootEl.children[clone.sortableIndex + (elementsInserted ? Number(i) : 0)];
                                                                                                                                            
                                                                                                                                                  if (target) {
                                                                                                                                            Severity: Major
                                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js and 1 other location - About 2 hrs to fix
                                                                                                                                            app/assets/javascripts/admin2/sortable.js on lines 3664..3674

                                                                                                                                            Duplicated Code

                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                            Tuning

                                                                                                                                            This issue has a mass of 89.

                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                            Refactorings

                                                                                                                                            Further Reading

                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                            Open

                                                                                                                                                  for (var fn in this) {
                                                                                                                                                    if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
                                                                                                                                                      this[fn] = this[fn].bind(this);
                                                                                                                                                    }
                                                                                                                                                  }
                                                                                                                                            Severity: Major
                                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js and 1 other location - About 1 hr to fix
                                                                                                                                            app/assets/javascripts/admin2/sortable.js on lines 3102..3106

                                                                                                                                            Duplicated Code

                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                            Tuning

                                                                                                                                            This issue has a mass of 71.

                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                            Refactorings

                                                                                                                                            Further Reading

                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                            Open

                                                                                                                                                  for (var fn in this) {
                                                                                                                                                    if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
                                                                                                                                                      this[fn] = this[fn].bind(this);
                                                                                                                                                    }
                                                                                                                                                  }
                                                                                                                                            Severity: Major
                                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js and 1 other location - About 1 hr to fix
                                                                                                                                            app/assets/javascripts/admin2/sortable.js on lines 2701..2705

                                                                                                                                            Duplicated Code

                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                            Tuning

                                                                                                                                            This issue has a mass of 71.

                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                            Refactorings

                                                                                                                                            Further Reading

                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                            Open

                                                                                                                                                  var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
                                                                                                                                            Severity: Major
                                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js and 1 other location - About 1 hr to fix
                                                                                                                                            app/assets/javascripts/admin2/sortable.js on lines 2863..2863

                                                                                                                                            Duplicated Code

                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                            Tuning

                                                                                                                                            This issue has a mass of 67.

                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                            Refactorings

                                                                                                                                            Further Reading

                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                            Open

                                                                                                                                                  var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
                                                                                                                                            Severity: Major
                                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js and 1 other location - About 1 hr to fix
                                                                                                                                            app/assets/javascripts/admin2/sortable.js on lines 2862..2862

                                                                                                                                            Duplicated Code

                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                            Tuning

                                                                                                                                            This issue has a mass of 67.

                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                            Refactorings

                                                                                                                                            Further Reading

                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                            Open

                                                                                                                                                    var evt = _ref12.originalEvent,
                                                                                                                                                        rootEl = _ref12.rootEl,
                                                                                                                                                        parentEl = _ref12.parentEl,
                                                                                                                                                        sortable = _ref12.sortable,
                                                                                                                                                        dispatchSortableEvent = _ref12.dispatchSortableEvent,
                                                                                                                                            Severity: Major
                                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js and 1 other location - About 1 hr to fix
                                                                                                                                            app/assets/javascripts/admin2/sortable.js on lines 2913..2919

                                                                                                                                            Duplicated Code

                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                            Tuning

                                                                                                                                            This issue has a mass of 65.

                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                            Refactorings

                                                                                                                                            Further Reading

                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                            Open

                                                                                                                                                var originalEvent = _ref.originalEvent,
                                                                                                                                                    putSortable = _ref.putSortable,
                                                                                                                                                    dragEl = _ref.dragEl,
                                                                                                                                                    activeSortable = _ref.activeSortable,
                                                                                                                                                    dispatchSortableEvent = _ref.dispatchSortableEvent,
                                                                                                                                            Severity: Major
                                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js and 1 other location - About 1 hr to fix
                                                                                                                                            app/assets/javascripts/admin2/sortable.js on lines 3384..3390

                                                                                                                                            Duplicated Code

                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                            Tuning

                                                                                                                                            This issue has a mass of 65.

                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                            Refactorings

                                                                                                                                            Further Reading

                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                            Open

                                                                                                                                                        dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),
                                                                                                                                            Severity: Major
                                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js and 1 other location - About 1 hr to fix
                                                                                                                                            app/assets/javascripts/admin2/sortable.js on lines 1641..1641

                                                                                                                                            Duplicated Code

                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                            Tuning

                                                                                                                                            This issue has a mass of 63.

                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                            Refactorings

                                                                                                                                            Further Reading

                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                            Open

                                                                                                                                                        dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1); // only set the status to dragging, when we are actually dragging
                                                                                                                                            Severity: Major
                                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js and 1 other location - About 1 hr to fix
                                                                                                                                            app/assets/javascripts/admin2/sortable.js on lines 1640..1640

                                                                                                                                            Duplicated Code

                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                            Tuning

                                                                                                                                            This issue has a mass of 63.

                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                            Refactorings

                                                                                                                                            Further Reading

                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                            Open

                                                                                                                                                    var sortable = _ref10.sortable,
                                                                                                                                                        isOwner = _ref10.isOwner,
                                                                                                                                                        insertion = _ref10.insertion,
                                                                                                                                                        activeSortable = _ref10.activeSortable,
                                                                                                                                                        parentEl = _ref10.parentEl,
                                                                                                                                            Severity: Major
                                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js and 1 other location - About 1 hr to fix
                                                                                                                                            app/assets/javascripts/admin2/sortable.js on lines 3007..3012

                                                                                                                                            Duplicated Code

                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                            Tuning

                                                                                                                                            This issue has a mass of 56.

                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                            Refactorings

                                                                                                                                            Further Reading

                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                            Open

                                                                                                                                                    var completed = _ref2.completed,
                                                                                                                                                        target = _ref2.target,
                                                                                                                                                        onMove = _ref2.onMove,
                                                                                                                                                        activeSortable = _ref2.activeSortable,
                                                                                                                                                        changed = _ref2.changed,
                                                                                                                                            Severity: Major
                                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js and 1 other location - About 1 hr to fix
                                                                                                                                            app/assets/javascripts/admin2/sortable.js on lines 3304..3309

                                                                                                                                            Duplicated Code

                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                            Tuning

                                                                                                                                            This issue has a mass of 56.

                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                            Refactorings

                                                                                                                                            Further Reading

                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                            Open

                                                                                                                                                return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;
                                                                                                                                            Severity: Major
                                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js and 1 other location - About 1 hr to fix
                                                                                                                                            app/assets/javascripts/admin2/sortable.js on lines 779..779

                                                                                                                                            Duplicated Code

                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                            Tuning

                                                                                                                                            This issue has a mass of 55.

                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                            Refactorings

                                                                                                                                            Further Reading

                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                            Open

                                                                                                                                                  if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {
                                                                                                                                            Severity: Minor
                                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js and 1 other location - About 50 mins to fix
                                                                                                                                            app/assets/javascripts/admin2/sortable.js on lines 1644..1644

                                                                                                                                            Duplicated Code

                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                            Tuning

                                                                                                                                            This issue has a mass of 51.

                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                            Refactorings

                                                                                                                                            Further Reading

                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                            Open

                                                                                                                                                      if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {
                                                                                                                                            Severity: Minor
                                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js and 1 other location - About 50 mins to fix
                                                                                                                                            app/assets/javascripts/admin2/sortable.js on lines 1506..1506

                                                                                                                                            Duplicated Code

                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                            Tuning

                                                                                                                                            This issue has a mass of 51.

                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                            Refactorings

                                                                                                                                            Further Reading

                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                            Open

                                                                                                                                                  _checkKeyUp: function _checkKeyUp(evt) {
                                                                                                                                                    if (evt.key === this.options.multiDragKey) {
                                                                                                                                                      this.multiDragKeyDown = false;
                                                                                                                                                    }
                                                                                                                                                  }
                                                                                                                                            Severity: Minor
                                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js and 1 other location - About 35 mins to fix
                                                                                                                                            app/assets/javascripts/admin2/sortable.js on lines 3570..3574

                                                                                                                                            Duplicated Code

                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                            Tuning

                                                                                                                                            This issue has a mass of 47.

                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                            Refactorings

                                                                                                                                            Further Reading

                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                            Open

                                                                                                                                                    canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');
                                                                                                                                            Severity: Minor
                                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js and 1 other location - About 35 mins to fix
                                                                                                                                            app/assets/javascripts/admin2/sortable.js on lines 2855..2855

                                                                                                                                            Duplicated Code

                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                            Tuning

                                                                                                                                            This issue has a mass of 47.

                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                            Refactorings

                                                                                                                                            Further Reading

                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                            Open

                                                                                                                                                    canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');
                                                                                                                                            Severity: Minor
                                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js and 1 other location - About 35 mins to fix
                                                                                                                                            app/assets/javascripts/admin2/sortable.js on lines 2856..2856

                                                                                                                                            Duplicated Code

                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                            Tuning

                                                                                                                                            This issue has a mass of 47.

                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                            Refactorings

                                                                                                                                            Further Reading

                                                                                                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                            Open

                                                                                                                                                  _checkKeyDown: function _checkKeyDown(evt) {
                                                                                                                                                    if (evt.key === this.options.multiDragKey) {
                                                                                                                                                      this.multiDragKeyDown = true;
                                                                                                                                                    }
                                                                                                                                                  },
                                                                                                                                            Severity: Minor
                                                                                                                                            Found in app/assets/javascripts/admin2/sortable.js and 1 other location - About 35 mins to fix
                                                                                                                                            app/assets/javascripts/admin2/sortable.js on lines 3575..3579

                                                                                                                                            Duplicated Code

                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                            Tuning

                                                                                                                                            This issue has a mass of 47.

                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                            Refactorings

                                                                                                                                            Further Reading

                                                                                                                                            There are no issues that match your filters.

                                                                                                                                            Category
                                                                                                                                            Status