BookStackApp/BookStack

View on GitHub

Showing 889 of 1,485 total issues

Function $createChildren has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  children: Array<NodeKey>,
  element: ElementNode,
  _startIndex: number,
  endIndex: number,
  dom: null | HTMLElement,
Severity: Minor
Found in resources/js/wysiwyg/lexical/core/LexicalReconciler.ts - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                if (combinedFormat === 0) {
                  break;
                }
    Severity: Major
    Found in resources/js/wysiwyg/lexical/core/LexicalEvents.ts - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  if (node === lastNode) {
                    if (
                      anchor.type !== 'element' ||
                      focus.type !== 'element' ||
                      focus.offset === anchor.offset
      Severity: Major
      Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    if (!firstAndLastElementsAreEqual) {
                      insertionTarget.insertAfter(lastNodeChild, false);
                    }
        Severity: Major
        Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                    if (descendant === null) {
                      resolvedElement = child;
                    } else {
                      child = descendant;
                      resolvedElement = $isElementNode(child)
          Severity: Major
          Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 45 mins to fix

            Function $reconcileRoot has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              prevEditorState: EditorState,
              nextEditorState: EditorState,
              editor: LexicalEditor,
              dirtyType: 0 | 1 | 2,
              dirtyElements: Map<NodeKey, IntentionallyMarkedAsDirtyElement>,
            Severity: Minor
            Found in resources/js/wysiwyg/lexical/core/LexicalReconciler.ts - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          if ($isElementNode(anchorNode)) {
                            anchorNode.select(0);
                          } else {
                            anchorNode.getParentOrThrow().select(0);
                          }
              Severity: Major
              Found in resources/js/wysiwyg/lexical/core/LexicalEvents.ts - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                    } else if (!IS_FIREFOX && isSelectAll(key, metaKey, ctrlKey)) {
                      event.preventDefault();
                      dispatchCommand(editor, SELECT_ALL_COMMAND, event);
                    }
                Severity: Major
                Found in resources/js/wysiwyg/lexical/core/LexicalEvents.ts - About 45 mins to fix

                  Function $internalMakeRangeSelection has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    anchorKey: NodeKey,
                    anchorOffset: number,
                    focusKey: NodeKey,
                    focusOffset: number,
                    anchorType: 'text' | 'element',
                  Severity: Minor
                  Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                for (let s = 0; s < removedDOMsLength; s++) {
                                  const removedDOM = removedDOMs[s];
                    
                                  if (
                                    (removedDOM.nodeName === 'BR' &&
                    Severity: Major
                    Found in resources/js/wysiwyg/lexical/core/LexicalMutations.ts - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                  if ($isElementNode(lastValidNode)) {
                                    lastValidNode.selectEnd();
                                  } else {
                                    lastValidNode.getParentOrThrow().selectEnd();
                                  }
                      Severity: Major
                      Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 45 mins to fix

                        Function generatePermutations has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function generatePermutations<T>(
                          values: T[],
                          maxLength = values.length,
                        ): T[][] {
                          if (maxLength > values.length) {
                        Severity: Minor
                        Found in resources/js/wysiwyg/lexical/core/__tests__/utils/index.ts - About 45 mins 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

                        Avoid deeply nested control flow statements.
                        Open

                                      if (currentDOM == null) {
                                        targetDOM.appendChild(correctDOM);
                                        currentDOM = correctDOM;
                                      } else if (currentDOM !== correctDOM) {
                                        targetDOM.replaceChild(correctDOM, currentDOM);
                        Severity: Major
                        Found in resources/js/wysiwyg/lexical/core/LexicalMutations.ts - About 45 mins to fix

                          Function applySelectionTransforms has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export function applySelectionTransforms(
                            nextEditorState: EditorState,
                            editor: LexicalEditor,
                          ): void {
                            const prevEditorState = editor.getEditorState();
                          Severity: Minor
                          Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 45 mins 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

                          Avoid deeply nested control flow statements.
                          Open

                                    if (nodeType === DOM_ELEMENT_TYPE || nodeType === DOM_TEXT_TYPE) {
                                      const newSelection = $internalCreateRangeSelection(
                                        lastSelection,
                                        domSelection,
                                        editor,
                          Severity: Major
                          Found in resources/js/wysiwyg/lexical/core/LexicalEvents.ts - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                        if ($isElementNode(firstValidNode)) {
                                          firstValidNode.selectStart();
                                        } else {
                                          firstValidNode.getParentOrThrow().selectStart();
                                        }
                            Severity: Major
                            Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                          if (
                                            lastNode instanceof ParagraphNode &&
                                            lastNode.getChildrenSize() === 0
                                          ) {
                                            selection.format = lastNode.getTextFormat();
                              Severity: Major
                              Found in resources/js/wysiwyg/lexical/core/LexicalEvents.ts - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                            if (
                                              parentDOM != null &&
                                              addedDOM !== blockCursorElement &&
                                              node === null &&
                                              (addedDOM.nodeName !== 'BR' ||
                                Severity: Major
                                Found in resources/js/wysiwyg/lexical/core/LexicalMutations.ts - About 45 mins to fix

                                  Function setElementIndent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  function setElementIndent(dom: HTMLElement, indent: number): void {
                                    const indentClassName = activeEditorConfig.theme.indent;
                                  
                                    if (typeof indentClassName === 'string') {
                                      const elementHasClassName = dom.classList.contains(indentClassName);
                                  Severity: Minor
                                  Found in resources/js/wysiwyg/lexical/core/LexicalReconciler.ts - About 45 mins 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 $internalResolveSelectionPoints has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                    anchorDOM: null | Node,
                                    anchorOffset: number,
                                    focusDOM: null | Node,
                                    focusOffset: number,
                                    editor: LexicalEditor,
                                  Severity: Minor
                                  Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 45 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language