addon/src/modifiers/sortable-group.js
SortableGroupModifier
has 44 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export default class SortableGroupModifier extends Modifier {
/** Primary keyboard utils */
// Tracks the currently selected item
_selectedItem = null;
// Tracks the current move
File sortable-group.js
has 407 lines of code (exceeds 250 allowed). Consider refactoring. Open
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 {
Function _handleKeyboardReorder
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_handleKeyboardReorder(event) {
const direction = this.direction;
const selectedItem = this._selectedItem;
if (direction === 'y' && isDownArrowKey(event)) {
Function _handleKeyboardReorder
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
_handleKeyboardReorder(event) {
const direction = this.direction;
const selectedItem = this._selectedItem;
if (direction === 'y' && isDownArrowKey(event)) {
- Read upRead up
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
Open
_updateHandleVisualIndicators(item, isUpdate) {
const handleVisualClass = this.handleVisualClass;
if (handleVisualClass === NO_MODEL || !item) {
return;
- Read upRead up
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"