BookStackApp/BookStack

View on GitHub

Showing 889 of 1,485 total issues

File index.ts has 395 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/history/index.ts - About 5 hrs to fix

    Function getNodes has 132 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      getNodes(): Array<LexicalNode> {
        const cachedNodes = this._cachedNodes;
        if (cachedNodes !== null) {
          return cachedNodes;
        }
    Severity: Major
    Found in resources/js/wysiwyg/lexical/table/LexicalTableSelection.ts - About 5 hrs to fix

      File clipboard.ts has 386 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/clipboard/clipboard.ts - About 5 hrs to fix

        Function positionNodeOnRange has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function positionNodeOnRange(
          editor: LexicalEditor,
          range: Range,
          onReposition: (node: Array<HTMLElement>) => void,
        ): () => void {
        Severity: Minor
        Found in resources/js/wysiwyg/lexical/utils/positionNodeOnRange.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 getNodes has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
        Open

          getNodes(): Array<LexicalNode> {
            const cachedNodes = this._cachedNodes;
            if (cachedNodes !== null) {
              return cachedNodes;
            }
        Severity: Minor
        Found in resources/js/wysiwyg/lexical/table/LexicalTableSelection.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 formatText has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
        Open

          formatText(formatType: TextFormatType): void {
            if (this.isCollapsed()) {
              this.toggleFormat(formatType);
              // When changing format, we should stop composition
              $setCompositionKey(null);
        Severity: Minor
        Found in resources/js/wysiwyg/lexical/core/LexicalSelection.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 $updateTextNodeFromDOMContent has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
        Open

        export function $updateTextNodeFromDOMContent(
          textNode: TextNode,
          textContent: string,
          anchorOffset: null | number,
          focusOffset: null | number,
        Severity: Minor
        Found in resources/js/wysiwyg/lexical/core/LexicalUtils.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 $convertTextDOMNode has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
        Open

        function $convertTextDOMNode(domNode: Node): DOMConversionOutput {
          const domNode_ = domNode as Text;
          const parentDom = domNode.parentElement;
          invariant(
            parentDom !== null,
        Severity: Minor
        Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.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 $reconcileNode has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
        Open

        function $reconcileNode(
          key: NodeKey,
          parentDOM: HTMLElement | null,
        ): HTMLElement {
          const prevNode = activePrevNodeMap.get(key);
        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

        File formatList.ts has 377 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/formatList.ts - About 5 hrs to fix

          Function createEditor has 125 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function createEditor(editorConfig?: CreateEditorArgs): LexicalEditor {
            const config = editorConfig || {};
            const activeEditor = internalGetActiveEditor();
            const theme = config.theme || {};
            const parentEditor =
          Severity: Major
          Found in resources/js/wysiwyg/lexical/core/LexicalEditor.ts - About 5 hrs to fix

            Function $beginUpdate has 125 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function $beginUpdate(
              editor: LexicalEditor,
              updateFn: () => void,
              options?: EditorUpdateOptions,
            ): void {
            Severity: Major
            Found in resources/js/wysiwyg/lexical/core/LexicalUpdates.ts - About 5 hrs to fix

              Function updateDOMSelection has 124 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function updateDOMSelection(
                prevSelection: BaseSelection | null,
                nextSelection: BaseSelection | null,
                editor: LexicalEditor,
                domSelection: Selection,
              Severity: Major
              Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 4 hrs to fix

                Function selectTableNodeInDirection has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                Open

                const selectTableNodeInDirection = (
                  tableObserver: TableObserver,
                  tableNode: TableNode,
                  x: number,
                  y: number,
                Severity: Minor
                Found in resources/js/wysiwyg/lexical/table/LexicalTableSelectionHelpers.ts - About 4 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 $beginUpdate has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                Open

                function $beginUpdate(
                  editor: LexicalEditor,
                  updateFn: () => void,
                  options?: EditorUpdateOptions,
                ): void {
                Severity: Minor
                Found in resources/js/wysiwyg/lexical/core/LexicalUpdates.ts - About 4 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 setTextThemeClassNames has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                Open

                function setTextThemeClassNames(
                  tag: string,
                  prevFormat: number,
                  nextFormat: number,
                  dom: HTMLElement,
                Severity: Minor
                Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 4 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 tables.ts has 370 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import {EditorBasicButtonDefinition, EditorButtonDefinition} from "../../framework/buttons";
                import tableIcon from "@icons/editor/table.svg";
                import deleteIcon from "@icons/editor/table-delete.svg";
                import deleteColumnIcon from "@icons/editor/table-delete-column.svg";
                import deleteRowIcon from "@icons/editor/table-delete-row.svg";
                Severity: Minor
                Found in resources/js/wysiwyg/ui/defaults/buttons/tables.ts - About 4 hrs to fix

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

                  export function $sliceSelectedTextNodeContent(
                    selection: BaseSelection,
                    textNode: TextNode,
                  ): LexicalNode {
                    const anchorAndFocus = selection.getStartEndPoints();
                  Severity: Minor
                  Found in resources/js/wysiwyg/lexical/selection/lexical-node.ts - About 4 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 syncChildrenFromYjs has 117 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    syncChildrenFromYjs(binding: Binding): void {
                      // Now diff the children of the collab node with that of our existing Lexical node.
                      const lexicalNode = this.getNode();
                      invariant(
                        lexicalNode !== null,
                  Severity: Major
                  Found in resources/js/wysiwyg/lexical/yjs/CollabElementNode.ts - About 4 hrs to fix

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

                    export function $insertDataTransferForRichText(
                      dataTransfer: DataTransfer,
                      selection: BaseSelection,
                      editor: LexicalEditor,
                    ): void {
                    Severity: Minor
                    Found in resources/js/wysiwyg/lexical/clipboard/clipboard.ts - About 4 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

                    Severity
                    Category
                    Status
                    Source
                    Language