jgwhite/ember-sortable

View on GitHub

Showing 26 of 86 total issues

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

import Modifier from 'ember-modifier';
import { Promise, defer } from 'rsvp';
import {action, set} from '@ember/object';
import {reads} from '@ember/object/computed';
import {or} from '@ember/object/computed';
Severity: Minor
Found in addon/modifiers/sortable-item.js - About 6 hrs to fix

    SortableItemModifier has 46 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export default class SortableItemModifier extends Modifier {
    
      className = "sortable-item";
    
      _sortableGroup;
    Severity: Minor
    Found in addon/modifiers/sortable-item.js - About 6 hrs to fix

      SortableGroupModifier has 45 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export default class SortableGroupModifier extends Modifier {
      
        /** Primary keyboard utils */
        // Tracks the currently selected item
        _selectedItem = null;
      Severity: Minor
      Found in addon/modifiers/sortable-group.js - About 6 hrs to fix

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

        import { Promise, defer } from 'rsvp';
        import Component from '@ember/component';
        import { computed, defineProperty } from '@ember/object';
        import { run, throttle } from '@ember/runloop';
        import { DEBUG } from '@glimmer/env';
        Severity: Minor
        Found in addon/components/sortable-item.js - About 5 hrs to fix

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

          import Modifier from 'ember-modifier';
          import {action, computed, set} from '@ember/object';
          import {
            isDownArrowKey,
            isEnterKey,
          Severity: Minor
          Found in addon/modifiers/sortable-group.js - About 5 hrs to fix

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

            import { A } from '@ember/array';
            import Component from '@ember/component';
            import { set, get, computed, defineProperty } from '@ember/object';
            import { run } from '@ember/runloop';
            import layout from '../templates/components/sortable-group';
            Severity: Minor
            Found in addon/components/sortable-group.js - About 5 hrs to fix

              `` has 33 functions (exceeds 20 allowed). Consider refactoring.
              Open

              export default Component.extend({
                layout,
                tagName: 'ol',
              
                attributeBindings: ['data-test-selector', 'tabindex', 'role'],
              Severity: Minor
              Found in addon/components/sortable-group.js - About 4 hrs to fix

                Function _setGetterSetters has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  _setGetterSetters() {
                    /**
                      True if the item transitions with animation.
                      @property isAnimated
                      @type Boolean
                Severity: Major
                Found in addon/components/sortable-item.js - About 2 hrs to fix

                  Function _scrollOnEdges has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    _scrollOnEdges(drag) {
                      let groupDirection = this.direction;
                      let element = this.element;
                      let scrollContainer = new ScrollContainer(scrollParent(element));
                      let itemContainer = {
                  Severity: Major
                  Found in addon/modifiers/sortable-item.js - About 2 hrs to fix

                    Function _scrollOnEdges has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      _scrollOnEdges(drag) {
                        let groupDirection = this.get('_direction');
                        let element = this.element;
                        let scrollContainer = new ScrollContainer(scrollParent(element));
                        let itemContainer = {
                    Severity: Major
                    Found in addon/components/sortable-item.js - About 2 hrs to fix

                      `` has 25 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      export default Component.extend({
                        layout,
                        tagName: 'li',
                        classNames: ['sortable-item'],
                        classNameBindings: ['isDragging', 'isDropping'],
                      Severity: Minor
                      Found in addon/components/sortable-item.js - About 2 hrs to fix

                        Function _scrollOnEdges has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                        Open

                          _scrollOnEdges(drag) {
                            let groupDirection = this.direction;
                            let element = this.element;
                            let scrollContainer = new ScrollContainer(scrollParent(element));
                            let itemContainer = {
                        Severity: Minor
                        Found in addon/modifiers/sortable-item.js - About 2 hrs to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Function _scrollOnEdges has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                        Open

                          _scrollOnEdges(drag) {
                            let groupDirection = this.get('_direction');
                            let element = this.element;
                            let scrollContainer = new ScrollContainer(scrollParent(element));
                            let itemContainer = {
                        Severity: Minor
                        Found in addon/components/sortable-item.js - About 2 hrs to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Function drag has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export async function drag(
                          mode,
                          itemSelector,
                          offsetFn,
                          callbacks = {}
                        Severity: Major
                        Found in addon-test-support/helpers/drag.js - About 2 hrs to fix

                          Function _setGetterSetters has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                            _setGetterSetters() {
                              /**
                                True if the item transitions with animation.
                                @property isAnimated
                                @type Boolean
                          Severity: Minor
                          Found in addon/components/sortable-item.js - About 2 hrs to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function _handleKeyboardReorder has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            _handleKeyboardReorder(event) {
                              const direction = this.direction;
                              const selectedItem = this._selectedItem;
                          
                              if (direction === "y" && isDownArrowKey(event)) {
                          Severity: Minor
                          Found in addon/modifiers/sortable-group.js - About 1 hr to fix

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

                              _handleKeyboardReorder(event) {
                                let  { direction, _selectedItem } = this.getProperties('direction', '_selectedItem');
                            
                                if (direction === "y" && isDownArrowKey(event)) {
                                  this.moveItem(_selectedItem, 1);
                            Severity: Minor
                            Found in addon/components/sortable-group.js - About 1 hr to fix

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

                                _makeDragHandler(startEvent) {
                                  const groupDirection = this.get('_direction');
                                  let dragOrigin;
                                  let elementOrigin;
                                  let scrollOrigin;
                              Severity: Minor
                              Found in addon/components/sortable-item.js - About 1 hr to fix

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

                                  _makeDragHandler(startEvent) {
                                    const groupDirection = this.direction;
                                    let dragOrigin;
                                    let elementOrigin;
                                    let scrollOrigin;
                                Severity: Minor
                                Found in addon/modifiers/sortable-item.js - About 1 hr to fix

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

                                  export async function drag(
                                    mode,
                                    itemSelector,
                                    offsetFn,
                                    callbacks = {}
                                  Severity: Minor
                                  Found in addon-test-support/helpers/drag.js - About 55 mins to fix

                                  Cognitive Complexity

                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                  A method's cognitive complexity is based on a few simple rules:

                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                  • Code is considered more complex for each "break in the linear flow of the code"
                                  • Code is considered more complex when "flow breaking structures are nested"

                                  Further reading

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language