File component.js
has 390 lines of code (exceeds 250 allowed). Consider refactoring. Open
//
// Copyright 2009-2014 Ilkka Oksanen <iao@iki.fi>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Function _dragWindowEnd
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
_dragWindowEnd(event) {
const cursor = this.cursor;
this.set('draggedWindow', false);
this.movingWindow.$().removeClass('moving').css('z-index', '');
- 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 _dragWindowEnd
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
_dragWindowEnd(event) {
const cursor = this.cursor;
this.set('draggedWindow', false);
this.movingWindow.$().removeClass('moving').css('z-index', '');
Function _drawCursor
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
_drawCursor(cursor) {
if (cursor.x === null) {
$('#window-cursor').hide();
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"
Further reading
Function _markWindow
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
_markWindow(masWindow, x, y, cursor) {
masWindow.cursor = 'none';
const rowCount = this.dimensions.length;
const columnCount = this.dimensions[y].length;
- 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 _drawCursor
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
_drawCursor(cursor) {
if (cursor.x === null) {
$('#window-cursor').hide();
return;
}
Function _layoutWindows
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
_layoutWindows(animate) {
const duration = animate ? 600 : 0;
const windowComponents = this.windowComponents;
const container = this._containerDimensions();
const expandedWindow = windowComponents.findBy('expanded', true);
Consider simplifying this complex logical expression. Open
if (
(y === 0 && cursor === 'top') ||
(y === rows - 1 && cursor === 'bottom') ||
(x === 0 && cursor === 'left') ||
(x === columns - 1 && cursor === 'right')
Function _whichSection
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
_whichSection(windowDim, x, y) {
// -----------------
// |\ t /|
// | \ / |
// | ----------- |
Function _calculateCursorPosition
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
_calculateCursorPosition(event) {
const outOfBoundsCursor = { x: null, y: null, section: null };
const x = event.clientX;
const y = event.clientY;
Consider simplifying this complex logical expression. Open
if (cursor.section === 'top' || cursor.section === 'bottom') {
deltaY = rowIndex > cursor.y || (rowIndex === cursor.y && cursor.section === 'top') ? 1 : 0;
} else {
deltaX =
rowIndex === cursor.y && (columnIndex > cursor.x || (columnIndex === cursor.x && cursor.section === 'left'))
Consider simplifying this complex logical expression. Open
} else if (
cursor.y === y &&
((section === 'right' && cursor.x === x) || (x < columnCount - 1 && cursor.x - 1 === x && section === 'left'))
) {
masWindow.cursor = 'right';
Consider simplifying this complex logical expression. Open
} else if (
cursor.y === y &&
((section === 'left' && cursor.x === x) || (x > 0 && cursor.x === x - 1 && section === 'right'))
) {
masWindow.cursor = 'left';
Function _whichSection
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
_whichSection(windowDim, x, y) {
// -----------------
// |\ t /|
// | \ / |
// | ----------- |
- 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 _calculateSpaceForCursor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
_calculateSpaceForCursor(x, y, cursor) {
let width = Math.round(CURSORWIDTH / 2);
const rows = this.dimensions.length;
const columns = this.dimensions[y].length;
- 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
Avoid too many return
statements within this function. Open
return 'left'; // l
Avoid too many return
statements within this function. Open
return null;