jgwhite/ember-sortable

View on GitHub

Showing 38 of 38 total issues

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

export default class ModifierController extends Controller {
  differentSizedModels = ['A', 'B'.repeat(100), 'D'.repeat(50), 'C'.repeat(20)];

  @tracked records = [
    { fruit: 'avocado', day: 'Monday' },
Severity: Major
Found in test-app/app/controllers/index.js and 1 other location - About 2 days to fix
docs/app/controllers/index.js on lines 5..67

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

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

export default class ModifierController extends Controller {
  differentSizedModels = ['A', 'B'.repeat(100), 'D'.repeat(50), 'C'.repeat(20)];

  @tracked records = [
    { fruit: 'avocado', day: 'Monday' },
Severity: Major
Found in docs/app/controllers/index.js and 1 other location - About 2 days to fix
test-app/app/controllers/index.js on lines 5..67

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

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

          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/src/modifiers/sortable-item.js and 1 other location - About 5 hrs to fix
          addon/src/modifiers/sortable-item.js on lines 534..547

          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/src/modifiers/sortable-item.js and 1 other location - About 5 hrs to fix
          addon/src/modifiers/sortable-item.js on lines 519..532

          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

          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

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

              module.exports = {
                test_page: 'tests/index.html?hidepassed',
                disable_watching: true,
                launch_in_ci: ['Chrome'],
                launch_in_dev: ['Chrome'],
              Severity: Major
              Found in test-app/testem.js and 1 other location - About 2 hrs to fix
              docs/testem.js on lines 3..23

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

              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

              module.exports = {
                test_page: 'tests/index.html?hidepassed',
                disable_watching: true,
                launch_in_ci: ['Chrome'],
                launch_in_dev: ['Chrome'],
              Severity: Major
              Found in docs/testem.js and 1 other location - About 2 hrs to fix
              test-app/testem.js on lines 3..23

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

              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 (environment === 'test') {
                  // Testem prefers this...
                  ENV.locationType = 'none';
              
                  // keep test console output quieter
              Severity: Major
              Found in docs/config/environment.js and 1 other location - About 2 hrs to fix
              test-app/config/environment.js on lines 34..44

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

              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 (environment === 'test') {
                  // Testem prefers this...
                  ENV.locationType = 'none';
              
                  // keep test console output quieter
              Severity: Major
              Found in test-app/config/environment.js and 1 other location - About 2 hrs to fix
              docs/config/environment.js on lines 51..61

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

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

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

                  removeEventListener() {
                    this.element.removeEventListener('keydown', this.keyDown);
                    this.element.removeEventListener('mousedown', this.mouseDown);
                    this.element.removeEventListener('touchstart', this.touchStart);
                    this.listenersRegistered = false;
                Severity: Major
                Found in addon/src/modifiers/sortable-item.js and 1 other location - About 2 hrs to fix
                addon/src/modifiers/sortable-item.js on lines 801..806

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

                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

                  addEventListener() {
                    this.element.addEventListener('keydown', this.keyDown);
                    this.element.addEventListener('mousedown', this.mouseDown);
                    this.element.addEventListener('touchstart', this.touchStart);
                    this.listenersRegistered = true;
                Severity: Major
                Found in addon/src/modifiers/sortable-item.js and 1 other location - About 2 hrs to fix
                addon/src/modifiers/sortable-item.js on lines 808..813

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

                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

                  scrollLeft(value) {
                    if (value) {
                      value = Math.max(0, Math.min(this.maxScrollLeft, value));
                      this.element.scrollLeft = value;
                      return value;
                Severity: Major
                Found in addon/src/system/scroll-container.js and 1 other location - About 1 hr to fix
                addon/src/system/scroll-container.js on lines 36..43

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

                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

                  scrollTop(value) {
                    if (value) {
                      value = Math.max(0, Math.min(this.maxScrollTop, value));
                      this.element.scrollTop = value;
                      return value;
                Severity: Major
                Found in addon/src/system/scroll-container.js and 1 other location - About 1 hr to fix
                addon/src/system/scroll-container.js on lines 45..52

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

                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

                Severity
                Category
                Status
                Source
                Language