BookStackApp/BookStack

View on GitHub

Showing 889 of 1,485 total issues

Function extract has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  extract(): Array<LexicalNode> {
    const selectedNodes = this.getNodes();
    const selectedNodesLength = selectedNodes.length;
    const lastIndex = selectedNodesLength - 1;
    const anchor = this.anchor;
Severity: Minor
Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 1 hr to fix

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

    export function $setInsetForSelection(editor: LexicalEditor, change: number): void {
        const selection = $getSelection();
        const listItemsInSelection = getListItemsForSelection(selection);
        const isListSelection = listItemsInSelection.length > 0 && !listItemsInSelection.includes(null);
    
    
    Severity: Minor
    Found in resources/js/wysiwyg/utils/lists.ts - About 1 hr 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 updateContextToolbars has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        protected updateContextToolbars(update: EditorUiStateUpdate): void {
            for (let i = this.activeContextToolbars.length - 1; i >= 0; i--) {
                const toolbar = this.activeContextToolbars[i];
                toolbar.destroy();
                this.activeContextToolbars.splice(i, 1);
    Severity: Minor
    Found in resources/js/wysiwyg/ui/framework/manager.ts - About 1 hr 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 containHtml has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function containHtml(string $htmlContent): string
        {
            $imageTagsOutput = [];
            preg_match_all("/\<img.*?src\=(\'|\")(.*?)(\'|\").*?\>/i", $htmlContent, $imageTagsOutput);
    
    
    Severity: Minor
    Found in app/Entities/Tools/ExportFormatter.php - About 1 hr 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 updateState has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        updateState(state: EditorUiStateUpdate) {
            super.updateState(state);
    
            for (const child of this.children) {
                if (child instanceof EditorButton && child.isActive()) {
    Severity: Minor
    Found in resources/js/wysiwyg/ui/framework/blocks/format-menu.ts - About 1 hr 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 getLastTextNode has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    function getLastTextNode(startingNode: Node) {
      let node = startingNode;
    
      mainLoop: while (node !== null) {
        if (node !== startingNode && node.nodeType === 3) {
    Severity: Minor
    Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 1 hr 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 $handleNormalizationMergeConflicts has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    function $handleNormalizationMergeConflicts(
      binding: Binding,
      normalizedNodes: Set<NodeKey>,
    ): void {
      // We handle the merge operations here
    Severity: Minor
    Found in resources/js/wysiwyg/lexical/yjs/SyncEditorStates.ts - About 1 hr 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 $syncEvent has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    function $syncEvent(binding: Binding, event: any): void {
      const {target} = event;
      const collabNode = $getOrInitCollabNodeFromSharedType(binding, target);
    
      if (collabNode instanceof CollabElementNode && event instanceof YTextEvent) {
    Severity: Minor
    Found in resources/js/wysiwyg/lexical/yjs/SyncEditorStates.ts - About 1 hr 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 $insertTableRow__EXPERIMENTAL has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    export function $insertTableRow__EXPERIMENTAL(insertAfter = true): void {
      const selection = $getSelection();
      invariant(
        $isRangeSelection(selection) || $isTableSelection(selection),
        'Expected a RangeSelection or TableSelection',
    Severity: Minor
    Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 1 hr 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 registerHistory has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    export function registerHistory(
      editor: LexicalEditor,
      historyState: HistoryState,
      delay: number,
    ): () => void {
    Severity: Minor
    Found in resources/js/wysiwyg/lexical/history/index.ts - About 1 hr 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 $shouldPreventDefaultAndInsertText has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    function $shouldPreventDefaultAndInsertText(
      selection: RangeSelection,
      domTargetRange: null | StaticRange,
      text: string,
      timeStamp: number,
    Severity: Minor
    Found in resources/js/wysiwyg/lexical/core/LexicalEvents.ts - About 1 hr 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 updateDOM has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      updateDOM(
        prevNode: TextNode,
        dom: HTMLElement,
        config: EditorConfig,
      ): boolean {
    Severity: Minor
    Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 1 hr 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 setTextContent has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    function setTextContent(
      nextText: string,
      dom: HTMLElement,
      node: TextNode,
    ): void {
    Severity: Minor
    Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 1 hr 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 drop has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function drop(editor, options, event) {
        const {dom} = editor;
        const rng = window.tinymce.dom.RangeUtils.getCaretRangeFromPoint(
            event.clientX,
            event.clientY,
    Severity: Minor
    Found in resources/js/wysiwyg-tinymce/drop-paste-handling.js - About 1 hr to fix

      Function buildDOM has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          buildDOM(): HTMLElement {
              const size = 10;
              const rows: HTMLElement[] = [];
              const cells: HTMLElement[] = [];
      
      
      Severity: Minor
      Found in resources/js/wysiwyg/ui/framework/blocks/table-creator.ts - About 1 hr to fix

        Function $handleListInsertParagraph has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function $handleListInsertParagraph(): boolean {
          const selection = $getSelection();
        
          if (!$isRangeSelection(selection) || !selection.isCollapsed()) {
            return false;
        Severity: Minor
        Found in resources/js/wysiwyg/lexical/list/formatList.ts - About 1 hr to fix

          Function $getTableEdgeCursorPosition has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function $getTableEdgeCursorPosition(
            editor: LexicalEditor,
            selection: RangeSelection,
            tableNode: TableNode,
          ) {
          Severity: Minor
          Found in resources/js/wysiwyg/lexical/table/LexicalTableSelectionHelpers.ts - About 1 hr to fix

            Function select has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              select(_anchorOffset?: number, _focusOffset?: number): RangeSelection {
                errorOnReadOnly();
                const selection = $getSelection();
                let anchorOffset = _anchorOffset;
                let focusOffset = _focusOffset;
            Severity: Minor
            Found in resources/js/wysiwyg/lexical/core/nodes/LexicalElementNode.ts - About 1 hr to fix

              Function register has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function register(editor) {
                  editor.addCommand('drawio', () => {
                      const selectedNode = editor.selection.getNode();
                      showDrawingEditor(editor, isDrawing(selectedNode) ? selectedNode : null);
                  });
              Severity: Minor
              Found in resources/js/wysiwyg-tinymce/plugin-drawio.js - About 1 hr to fix

                Function up has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            up(event: MouseEvent, marker: HTMLElement, distance: MouseDragTrackerDistance) {
                                marker.classList.remove('active');
                                marker.style.left = '0';
                                marker.style.top = '0';
                
                
                Severity: Minor
                Found in resources/js/wysiwyg/ui/framework/helpers/table-resizer.ts - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language