Showing 1,485 of 1,485 total issues
Avoid deeply nested control flow statements. Open
if (isSelected && splitStart === 0) {
const [excessNode] = currentNode.splitText(splitStart, splitEnd);
excessNode.remove();
} else {
const [, excessNode] = currentNode.splitText(splitStart, splitEnd);
Avoid deeply nested control flow statements. Open
if (part === '\n' || part === '\r\n') {
currentSelection.insertParagraph();
} else if (part === '\t') {
currentSelection.insertNodes([$createTabNode()]);
} else {
Avoid deeply nested control flow statements. Open
if (childKey !== '') {
collabKeys.add(childKey);
}
Avoid deeply nested control flow statements. Open
for (let i = segmentsLength - 1; i >= 0; i--) {
const segment = segments[i];
const nextIndex = segment.index;
if (segment.isWordLike) {
Function $getNextRightPreorderNode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function $getNextRightPreorderNode(
startingNode: LexicalNode,
): LexicalNode | null {
let node: LexicalNode | null = startingNode;
- 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 deeply nested control flow statements. Open
if (nextSibling.nodeName === 'P') {
nextSibling = nextSibling.lastChild;
}
Avoid deeply nested control flow statements. Open
if (iColumn === 0) {
headerState |= TableCellHeaderStates.COLUMN;
}
Avoid deeply nested control flow statements. Open
if ($isElementNode(anchorNode)) {
listItem.setFormat(anchorNode.getFormatType());
listItem.setIndent(anchorNode.getIndent());
}
Avoid deeply nested control flow statements. Open
if (listItemNode != null) {
listNodes.add($getTopListNode(listItemNode));
}
Avoid deeply nested control flow statements. Open
if (column === endColumn) {
// Overflowing right
const inSelectedArea = endColumn - cellStartColumn + 1;
cell.setColSpan(cell.__colSpan - inSelectedArea);
}
Avoid deeply nested control flow statements. Open
} else if ($isListItemNode(anchorNode)) {
const parent = anchorNode.getParentOrThrow();
append(list, parent.getChildren());
parent.replace(list);
}
Avoid deeply nested control flow statements. Open
if (previousSibling) {
previousSibling.insertAfter(newListItem);
} else if (nextSibling) {
nextSibling.insertBefore(newListItem);
} else {
Avoid deeply nested control flow statements. Open
if (newSelection) {
newSelection.anchor.set(
tableNode.getKey(),
selection.isBackward() ? tableNode.getChildrenSize() : 0,
'element',
Function getCordsFromCellNode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
getCordsFromCellNode(
tableCellNode: TableCellNode,
table: TableDOMTable,
): {x: number; y: number} {
const {rows, domRows} = table;
- 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 deeply nested control flow statements. Open
if ($isListNode(parent)) {
if (!handled.has(parentKey)) {
const newListNode = $createListNode(listType);
append(newListNode, parent.getChildren());
parent.replace(newListNode);
Function redo
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function redo(editor: LexicalEditor, historyState: HistoryState): void {
const redoStack = historyState.redoStack;
const undoStack = historyState.undoStack;
if (redoStack.length !== 0) {
- 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 deeply nested control flow statements. Open
if ($isRootOrShadowRoot(focusNode)) {
const selectedNode = selection.getNodes()[0];
if (selectedNode) {
const tableCellNode = $findMatchingParent(
selectedNode,
Avoid deeply nested control flow statements. Open
if (iRow === 0) {
headerState |= TableCellHeaderStates.ROW;
}
Avoid deeply nested control flow statements. Open
if (!tableObserver.isSelecting) {
setTimeout(() => {
const {onMouseUp, onMouseMove} = createMouseHandlers();
tableObserver.isSelecting = true;
editorWindow.addEventListener('mouseup', onMouseUp);
Avoid deeply nested control flow statements. Open
if (correctDOM === null) {
continue;
}