jgwhite/ember-sortable

View on GitHub

Showing 16 of 38 total issues

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

/* eslint-disable ember/no-computed-properties-in-native-classes */
import Modifier from 'ember-modifier';
import { Promise, defer } from 'rsvp';
import { action, set } from '@ember/object';
import { DRAG_ACTIONS, ELEMENT_CLICK_ACTION, END_ACTIONS } from '../utils/constant';
Severity: Major
Found in addon/src/modifiers/sortable-item.js - About 1 day to fix

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

    export default class SortableItemModifier extends Modifier {
      className = 'sortable-item';
    
      @service('ember-sortable-internal-state') sortableService;
    
    
    Severity: Minor
    Found in addon/src/modifiers/sortable-item.js - About 7 hrs to fix

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

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

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

        /* eslint-disable ember/no-computed-properties-in-native-classes */
        /* eslint-disable ember/no-incorrect-calls-with-inline-anonymous-functions */
        import Modifier from 'ember-modifier';
        import { action, computed, set } from '@ember/object';
        import {
        Severity: Minor
        Found in addon/src/modifiers/sortable-group.js - About 5 hrs to fix

          Function exports has 90 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = async function () {
            return {
              usePnpm: true,
              scenarios: [
                {
          Severity: Major
          Found in test-app/config/ember-try.js - About 3 hrs to fix

            Function _scrollOnEdges has 73 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/src/modifiers/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/src/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 drag has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export async function drag(mode, itemSelector, offsetFn, callbacks = {}) {
                let start;
                let move;
                let end;
                let which;
              Severity: Major
              Found in addon/src/test-support/helpers/drag.js - About 2 hrs to fix

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

                module.exports = function (environment) {
                  let ENV = {
                    modulePrefix: 'docs',
                    environment,
                    rootURL: '/',
                Severity: Minor
                Found in docs/config/environment.js - About 1 hr to fix

                  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/src/modifiers/sortable-group.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/src/modifiers/sortable-item.js - About 1 hr to fix

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

                      module.exports = function (environment) {
                        let ENV = {
                          modulePrefix: 'test-app',
                          environment,
                          rootURL: '/',
                      Severity: Minor
                      Found in test-app/config/environment.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 = {}) {
                          let start;
                          let move;
                          let end;
                          let which;
                        Severity: Minor
                        Found in addon/src/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

                        Function _handleKeyboardReorder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          _handleKeyboardReorder(event) {
                            const direction = this.direction;
                            const selectedItem = this._selectedItem;
                        
                            if (direction === 'y' && isDownArrowKey(event)) {
                        Severity: Minor
                        Found in addon/src/modifiers/sortable-group.js - About 35 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

                        Function _waitForTransition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          _waitForTransition() {
                            let waiterToken;
                        
                            if (DEBUG) {
                              waiterToken = sortableItemWaiter.beginAsync();
                        Severity: Minor
                        Found in addon/src/modifiers/sortable-item.js - About 25 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

                        Function _updateHandleVisualIndicators has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          _updateHandleVisualIndicators(item, isUpdate) {
                            const handleVisualClass = this.handleVisualClass;
                        
                            if (handleVisualClass === NO_MODEL || !item) {
                              return;
                        Severity: Minor
                        Found in addon/src/modifiers/sortable-group.js - About 25 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