jgwhite/ember-sortable

View on GitHub

Showing 86 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 390 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

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

                if (groupDirection === 'y') {
                  dragOrigin = getY(startEvent);
                  elementOrigin = this.get('y');
                  scrollOrigin = parentElement.getBoundingClientRect().top;
            
            
            Severity: Major
            Found in addon/components/sortable-item.js and 1 other location - About 5 hrs to fix
            addon/components/sortable-item.js on lines 457..470

            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 142.

            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

                if (groupDirection === 'x') {
                  dragOrigin = getX(startEvent);
                  elementOrigin = this.get('x');
                  scrollOrigin = parentElement.getBoundingClientRect().left;
            
            
            Severity: Major
            Found in addon/components/sortable-item.js and 1 other location - About 5 hrs to fix
            addon/components/sortable-item.js on lines 472..485

            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 142.

            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

            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

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

                  let itemContainer = {
                    width: parseInt(getComputedStyle(element).width, 10),
                    get height() {
                      return parseInt(getComputedStyle(element).height, 10);
                    },
              Severity: Major
              Found in addon/components/sortable-item.js and 1 other location - About 5 hrs to fix
              addon/modifiers/sortable-item.js on lines 388..405

              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 140.

              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

                  let itemContainer = {
                    width: parseInt(getComputedStyle(element).width, 10),
                    get height() {
                      return parseInt(getComputedStyle(element).height, 10);
                    },
              Severity: Major
              Found in addon/modifiers/sortable-item.js and 1 other location - About 5 hrs to fix
              addon/components/sortable-item.js on lines 360..377

              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 140.

              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

                  if (groupDirection === 'x') {
                    dragOrigin = getX(startEvent);
                    elementOrigin = this.x;
                    scrollOrigin = parentElement.getBoundingClientRect().left;
              
              
              Severity: Major
              Found in addon/modifiers/sortable-item.js and 1 other location - About 5 hrs to fix
              addon/modifiers/sortable-item.js on lines 497..510

              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 138.

              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

                  if (groupDirection === 'y') {
                    dragOrigin = getY(startEvent);
                    elementOrigin = this.y;
                    scrollOrigin = parentElement.getBoundingClientRect().top;
              
              
              Severity: Major
              Found in addon/modifiers/sortable-item.js and 1 other location - About 5 hrs to fix
              addon/modifiers/sortable-item.js on lines 482..495

              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 138.

              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

              `` 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

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

                      get() {
                        let el = this.element;
                        let rule = getComputedStyle(el).transitionDuration;
                        let match = rule.match(/([\d.]+)([ms]*)/);
                
                
                Severity: Major
                Found in addon/components/sortable-item.js and 1 other location - About 3 hrs to fix
                addon/modifiers/sortable-item.js on lines 667..684

                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 106.

                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

                   get transitionDuration() {
                    let el = this.element;
                    let rule = getComputedStyle(el).transitionDuration;
                    let match = rule.match(/([\d.]+)([ms]*)/);
                
                
                Severity: Major
                Found in addon/modifiers/sortable-item.js and 1 other location - About 3 hrs to fix
                addon/components/sortable-item.js on lines 652..669

                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 106.

                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

                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.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

                        Severity
                        Category
                        Status
                        Source
                        Language