Showing 889 of 1,485 total issues
Function splitText
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
splitText(...splitOffsets: Array<number>): Array<TextNode> {
errorOnReadOnly();
const self = this.getLatest();
const textContent = self.getTextContent();
const key = self.__key;
- 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 updateDOMBlockCursorElement
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
export function updateDOMBlockCursorElement(
editor: LexicalEditor,
rootElement: HTMLElement,
nextSelection: null | BaseSelection,
): void {
- 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 findTextInLine
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
function findTextInLine(text: Text, forward: boolean): null | Text {
let node: Node = text;
// eslint-disable-next-line no-constant-condition
while (true) {
let sibling: null | Node;
- 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 register
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
function register(editor) {
editor.ui.registry.addIcon('codeblock', '<svg width="24" height="24"><path d="M4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 0 1-1-1V4c0-.6.4-1 1-1Zm1 2v14h14V5Z"/><path d="M11.103 15.423c.277.277.277.738 0 .922a.692.692 0 0 1-1.106 0l-4.057-3.78a.738.738 0 0 1 0-1.107l4.057-3.872c.276-.277.83-.277 1.106 0a.724.724 0 0 1 0 1.014L7.6 12.012ZM12.897 8.577c-.245-.312-.2-.675.08-.955.28-.281.727-.27 1.027.033l4.057 3.78a.738.738 0 0 1 0 1.107l-4.057 3.872c-.277.277-.83.277-1.107 0a.724.724 0 0 1 0-1.014l3.504-3.412z"/></svg>');
editor.ui.registry.addButton('codeeditor', {
tooltip: 'Insert code block',
Function addRootElementEvents
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function addRootElementEvents(
rootElement: HTMLElement,
editor: LexicalEditor,
): void {
// We only want to have a single global selectionchange event handler, shared
Function $reconcileNode
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
function $reconcileNode(
key: NodeKey,
parentDOM: HTMLElement | null,
): HTMLElement {
const prevNode = activePrevNodeMap.get(key);
File LexicalTableSelection.ts
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
Entity
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class Entity extends Model implements Sluggable, Favouritable, Viewable, Deletable, Loggable
{
use SoftDeletes;
use HasCreatorAndUpdater;
use HasOwner;
File index.ts
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
Function registerHistory
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function registerHistory(
editor: LexicalEditor,
historyState: HistoryState,
delay: number,
): () => void {
File LexicalTableCellNode.ts
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
File media.ts
has 308 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
DOMConversion,
DOMConversionMap, DOMConversionOutput, DOMExportOutput,
ElementNode,
LexicalEditor,
Function defineCodeBlockCustomElement
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
function defineCodeBlockCustomElement(editor) {
const doc = editor.getDoc();
const win = doc.defaultView;
class CodeBlockElement extends win.HTMLElement {
Function updateCursor
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateCursor(
binding: Binding,
cursor: Cursor,
nextSelection: null | CursorSelection,
nodeMap: NodeMap,
SearchRunner
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class SearchRunner
{
/**
* Retain a cache of score adjusted terms for specific search options.
*/
RangeSelection
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
export class RangeSelection implements BaseSelection {
format: number;
style: string;
anchor: PointType;
focus: PointType;
Function $reconcileChildren
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
function $reconcileChildren(
prevElement: ElementNode,
nextElement: ElementNode,
dom: HTMLElement,
): void {
Function removeFromParent
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
export function removeFromParent(node: LexicalNode): void {
const oldParent = node.getParent();
if (oldParent !== null) {
const writableNode = node.getWritable();
const writableParent = oldParent.getWritable();
- 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 $deleteTableColumn__EXPERIMENTAL
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
export function $deleteTableColumn__EXPERIMENTAL(): void {
const selection = $getSelection();
invariant(
$isRangeSelection(selection) || $isTableSelection(selection),
'Expected a RangeSelection or TableSelection',
- 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 $insertTableRow
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
export function $insertTableRow(
tableNode: TableNode,
targetIndex: number,
shouldInsertAfter = true,
rowCount: number,
- 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"