BookStackApp/BookStack

View on GitHub

Showing 889 of 1,485 total issues

File Utils.ts has 478 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.
Severity: Minor
Found in resources/js/wysiwyg/lexical/yjs/Utils.ts - About 7 hrs to fix

    Function deleteCharacter has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
    Open

      deleteCharacter(isBackward: boolean): void {
        const wasCollapsed = this.isCollapsed();
        if (this.isCollapsed()) {
          const anchor = this.anchor;
          let anchorNode: TextNode | ElementNode | null = anchor.getNode();
    Severity: Minor
    Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 7 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

    ElementNode has 50 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class ElementNode extends LexicalNode {
      ['constructor']!: KlassConstructor<typeof ElementNode>;
      /** @internal */
      __first: null | NodeKey;
      /** @internal */
    Severity: Minor
    Found in resources/js/wysiwyg/lexical/core/nodes/LexicalElementNode.ts - About 7 hrs to fix

      Function splice has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
      Open

        splice(
          start: number,
          deleteCount: number,
          nodesToInsert: Array<LexicalNode>,
        ): this {
      Severity: Minor
      Found in resources/js/wysiwyg/lexical/core/nodes/LexicalElementNode.ts - About 6 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 SyncCursors.ts has 451 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.
      Severity: Minor
      Found in resources/js/wysiwyg/lexical/yjs/SyncCursors.ts - About 6 hrs to fix

        File LexicalListItemNode.ts has 451 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.
        Severity: Minor
        Found in resources/js/wysiwyg/lexical/list/LexicalListItemNode.ts - About 6 hrs to fix

          Function $createNodesFromDOM has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
          Open

          function $createNodesFromDOM(
            node: Node,
            editor: LexicalEditor,
            allArtificialNodes: Array<ArtificialNode__DO_NOT_USE>,
            hasBlockAncestorLexicalNode: boolean,
          Severity: Minor
          Found in resources/js/wysiwyg/lexical/html/index.ts - About 6 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 $commitPendingUpdates has 166 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function $commitPendingUpdates(
            editor: LexicalEditor,
            recoveryEditorState?: EditorState,
          ): void {
            const pendingEditorState = editor._pendingEditorState;
          Severity: Major
          Found in resources/js/wysiwyg/lexical/core/LexicalUpdates.ts - About 6 hrs to fix

            File range-selection.ts has 443 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.
            Severity: Minor
            Found in resources/js/wysiwyg/lexical/selection/range-selection.ts - About 6 hrs to fix

              Function onKeyDown has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
              Open

              function onKeyDown(event: KeyboardEvent, editor: LexicalEditor): void {
                lastKeyDownTimeStamp = event.timeStamp;
                lastKeyCode = event.key;
                if (editor.isComposing()) {
                  return;
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/core/LexicalEvents.ts - About 6 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 updateDOMSelection has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
              Open

              export function updateDOMSelection(
                prevSelection: BaseSelection | null,
                nextSelection: BaseSelection | null,
                editor: LexicalEditor,
                domSelection: Selection,
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 6 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 $reconcileChildren has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
              Open

              function $reconcileChildren(
                prevElement: ElementNode,
                nextElement: ElementNode,
                dom: HTMLElement,
              ): void {
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/core/LexicalReconciler.ts - About 6 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 applyChildrenYjsDelta has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
              Open

                applyChildrenYjsDelta(
                  binding: Binding,
                  deltas: Array<{
                    insert?: string | object | AbstractType<unknown>;
                    delete?: number;
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/yjs/CollabElementNode.ts - About 5 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 $commitPendingUpdates has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
              Open

              export function $commitPendingUpdates(
                editor: LexicalEditor,
                recoveryEditorState?: EditorState,
              ): void {
                const pendingEditorState = editor._pendingEditorState;
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/core/LexicalUpdates.ts - About 5 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 $reconcileNodeChildren has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
              Open

              function $reconcileNodeChildren(
                nextElement: ElementNode,
                prevChildren: Array<NodeKey>,
                nextChildren: Array<NodeKey>,
                prevChildrenLength: number,
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/core/LexicalReconciler.ts - About 5 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 $flushMutations has 143 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function $flushMutations(
                editor: LexicalEditor,
                mutations: Array<MutationRecord>,
                observer: MutationObserver,
              ): void {
              Severity: Major
              Found in resources/js/wysiwyg/lexical/core/LexicalMutations.ts - About 5 hrs to fix

                TextNode has 42 functions (exceeds 20 allowed). Consider refactoring.
                Open

                export class TextNode extends LexicalNode {
                  ['constructor']!: KlassConstructor<typeof TextNode>;
                  __text: string;
                  /** @internal */
                  __format: number;
                Severity: Minor
                Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 5 hrs to fix

                  File index.ts has 401 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.
                  Severity: Minor
                  Found in resources/js/wysiwyg/lexical/utils/index.ts - About 5 hrs to fix

                    Function $wrapNodesImpl has 139 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function $wrapNodesImpl(
                      selection: BaseSelection,
                      nodes: LexicalNode[],
                      nodesLength: number,
                      createElement: () => ElementNode,
                    Severity: Major
                    Found in resources/js/wysiwyg/lexical/selection/range-selection.ts - About 5 hrs to fix

                      File LexicalAutoLinkNode.test.ts has 396 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.
                        Severity
                        Category
                        Status
                        Source
                        Language