Showing 889 of 1,485 total issues
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
File book-sort.js
has 301 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Sortable, {MultiDrag} from 'sortablejs';
import {Component} from './component';
import {htmlToDom} from '../services/dom';
// Auto sort control
File tables.ts
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
EditorFormDefinition,
EditorFormFieldDefinition,
EditorFormTabs,
EditorSelectFormFieldDefinition
Function insertNodes
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
insertNodes(nodes: Array<LexicalNode>): void {
if (nodes.length === 0) {
return;
}
if (this.anchor.key === 'root') {
User
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class User extends Model implements AuthenticatableContract, CanResetPasswordContract, Loggable, Sluggable
{
use HasFactory;
use Authenticatable;
use CanResetPassword;
TableCellNode
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
export class TableCellNode extends ElementNode {
/** @internal */
__colSpan: number;
/** @internal */
__rowSpan: number;
Function $createEditorContent
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
function $createEditorContent() {
const root = $getRoot();
if (root.getFirstChild() === null) {
const heading = $createHeadingNode('h1');
heading.append($createTextNode('Welcome to the playground'));
Function $appendNodesToHTML
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function $appendNodesToHTML(
editor: LexicalEditor,
currentNode: LexicalNode,
parentElement: HTMLElement | DocumentFragment,
selection: BaseSelection | null = null,
- 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 updateCursor
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function updateCursor(
binding: Binding,
cursor: Cursor,
nextSelection: null | CursorSelection,
nodeMap: NodeMap,
- 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 resolveSelectionPointOnBoundary
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function resolveSelectionPointOnBoundary(
point: TextPointType,
isBackward: boolean,
isCollapsed: boolean,
): 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 triggerCommandListeners
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
export function triggerCommandListeners<
TCommand extends LexicalCommand<unknown>,
>(
editor: LexicalEditor,
type: TCommand,
- 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 processNestedUpdates
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function processNestedUpdates(
editor: LexicalEditor,
initialSkipTransforms?: boolean,
): boolean {
const queuedUpdates = editor._updates;
- 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 $garbageCollectDetachedNodes
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
export function $garbageCollectDetachedNodes(
prevEditorState: EditorState,
editorState: EditorState,
dirtyLeaves: Set<NodeKey>,
dirtyElements: Map<NodeKey, IntentionallyMarkedAsDirtyElement>,
- 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 createPageEditorInstance
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createPageEditorInstance(container: HTMLElement, htmlContent: string, options: Record<string, any> = {}): SimpleWysiwygEditorInterface {
const config: CreateEditorArgs = {
namespace: 'BookStackPageEditor',
nodes: getNodesForPageEditor(),
onError: console.error,
Function syncChildrenFromLexical
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
syncChildrenFromLexical(
binding: Binding,
nextLexicalNode: ElementNode,
prevNodeMap: null | NodeMap,
dirtyElements: null | Map<NodeKey, IntentionallyMarkedAsDirtyElement>,
Function applyChildrenYjsDelta
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
applyChildrenYjsDelta(
binding: Binding,
deltas: Array<{
insert?: string | object | AbstractType<unknown>;
delete?: number;
File PageController.php
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace BookStack\Entities\Controllers;
use BookStack\Activity\Models\View;
Function getChangeType
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getChangeType(
prevEditorState: null | EditorState,
nextEditorState: EditorState,
dirtyLeavesSet: Set<NodeKey>,
dirtyElementsSet: Map<NodeKey, IntentionallyMarkedAsDirtyElement>,
Function $reconcileNodeChildren
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
function $reconcileNodeChildren(
nextElement: ElementNode,
prevChildren: Array<NodeKey>,
nextChildren: Array<NodeKey>,
prevChildrenLength: number,
File config.js
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {register as registerShortcuts} from './shortcuts';
import {listen as listenForCommonEvents} from './common-events';
import {scrollToQueryString} from './scrolling';
import {listenForDragAndPaste} from './drop-paste-handling';
import {getPrimaryToolbar, registerAdditionalToolbars} from './toolbars';