BookStackApp/BookStack

View on GitHub

Showing 882 of 1,478 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();
Severity: Minor
Found in resources/js/wysiwyg/lexical/core/LexicalUtils.ts - About 3 hrs to fix

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
Severity: Minor
Found in resources/js/components/book-sort.js - About 3 hrs to fix

    File tables.ts has 300 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {
        EditorFormDefinition,
        EditorFormFieldDefinition,
        EditorFormTabs,
        EditorSelectFormFieldDefinition
    Severity: Minor
    Found in resources/js/wysiwyg/ui/defaults/forms/tables.ts - About 3 hrs to fix

      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') {
      Severity: Major
      Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 3 hrs to fix

        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;
        Severity: Minor
        Found in app/Users/Models/User.php - About 3 hrs to fix

          TableCellNode has 27 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export class TableCellNode extends ElementNode {
            /** @internal */
            __colSpan: number;
            /** @internal */
            __rowSpan: number;
          Severity: Minor
          Found in resources/js/wysiwyg/lexical/table/LexicalTableCellNode.ts - About 3 hrs to fix

            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,
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/html/index.ts - About 3 hrs to fix

              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,
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/yjs/SyncCursors.ts - About 3 hrs to fix

              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 {
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 3 hrs to fix

              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,
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/core/LexicalUpdates.ts - About 3 hrs to fix

              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>,
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/core/LexicalGC.ts - About 3 hrs to fix

              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;
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/core/LexicalUpdates.ts - About 3 hrs to fix

              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,
              Severity: Major
              Found in resources/js/wysiwyg/index.ts - About 3 hrs to fix

                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;
                Severity: Major
                Found in resources/js/wysiwyg/lexical/yjs/CollabElementNode.ts - About 3 hrs to fix

                  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>,
                  Severity: Major
                  Found in resources/js/wysiwyg/lexical/yjs/CollabElementNode.ts - About 3 hrs to fix

                    File PageController.php has 293 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    namespace BookStack\Entities\Controllers;
                    
                    use BookStack\Activity\Models\View;
                    Severity: Minor
                    Found in app/Entities/Controllers/PageController.php - About 3 hrs to fix

                      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>,
                      Severity: Major
                      Found in resources/js/wysiwyg/lexical/history/index.ts - About 3 hrs to fix

                        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,
                        Severity: Major
                        Found in resources/js/wysiwyg/lexical/core/LexicalReconciler.ts - About 3 hrs to fix

                          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';
                          Severity: Minor
                          Found in resources/js/wysiwyg-tinymce/config.js - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language