BookStackApp/BookStack

View on GitHub

Showing 889 of 1,485 total issues

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

  nextElement: ElementNode,
  prevChildren: Array<NodeKey>,
  nextChildren: Array<NodeKey>,
  prevChildrenLength: number,
  nextChildrenLength: number,
Severity: Minor
Found in resources/js/wysiwyg/lexical/core/LexicalReconciler.ts - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

          if (isCopy(key, shiftKey, metaKey, ctrlKey)) {
            event.preventDefault();
            dispatchCommand(editor, COPY_COMMAND, event);
          } else if (isCut(key, shiftKey, metaKey, ctrlKey)) {
            event.preventDefault();
    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 (node === lastNode) {
                  text = isBefore
                    ? text.slice(0, focusOffset)
                    : text.slice(0, anchorOffset);
                }
      Severity: Major
      Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                  if (
                    anchorNode.is(focusNode) ||
                    (isBackward && offset !== 0) ||
                    (!isBackward && offset !== textContentSize)
                  ) {
        Severity: Major
        Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                      if (removedDOMsLength !== unremovedBRs) {
                        if (targetDOM === rootElement) {
                          targetNode = internalGetRoot(currentEditorState);
                        }
          
          
          Severity: Major
          Found in resources/js/wysiwyg/lexical/core/LexicalMutations.ts - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                      if (
                        // eslint-disable-next-line no-prototype-builtins
                        !proto.hasOwnProperty('exportJSON')
                      ) {
                        console.warn(
            Severity: Major
            Found in resources/js/wysiwyg/lexical/core/LexicalEditor.ts - About 45 mins to fix

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

                node: ElementNode,
                parentKey: NodeKey,
                prevNodeMap: NodeMap,
                nodeMap: NodeMap,
                nodeMapDelete: Array<NodeKey>,
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/core/LexicalGC.ts - About 45 mins to fix

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

                function drawReceive(event: MessageEvent) {
                    if (!event.data || event.data.length < 1) return;
                    if (event.origin !== lastApprovedOrigin) return;
                
                    const message = JSON.parse(event.data);
                Severity: Minor
                Found in resources/js/services/drawio.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 (!klass.hasOwnProperty(method)) {
                              console.warn(`${name} must implement static "${method}" method`);
                            }
                Severity: Major
                Found in resources/js/wysiwyg/lexical/core/LexicalEditor.ts - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                            if (proto instanceof DecoratorNode) {
                              // eslint-disable-next-line no-prototype-builtins
                              if (!proto.hasOwnProperty('decorate')) {
                                console.warn(
                                  `${proto.constructor.name} must implement "decorate" method`,
                  Severity: Major
                  Found in resources/js/wysiwyg/lexical/core/LexicalEditor.ts - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                              for (let j = 0; j < listenersLength; j++) {
                                if (listeners[j](payload, editor) === true) {
                                  return true;
                                }
                              }
                    Severity: Major
                    Found in resources/js/wysiwyg/lexical/core/LexicalUpdates.ts - About 45 mins to fix

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

                        innerDOM: HTMLElement,
                        node: TextNode,
                        innerTag: string,
                        format: number,
                        text: string,
                      Severity: Minor
                      Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                      if (node.isAttached()) {
                                        node.remove();
                                      }
                        Severity: Major
                        Found in resources/js/wysiwyg/lexical/core/LexicalUtils.ts - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                    if (prevFormat & flag) {
                                      domClassList.remove(...classNames);
                                    }
                          Severity: Major
                          Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 45 mins to fix

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

                            function parseRefs(name: string, element: HTMLElement):
                                {refs: Record<string, HTMLElement>, manyRefs: Record<string, HTMLElement[]>} {
                                const refs: Record<string, HTMLElement> = {};
                                const manyRefs: Record<string, HTMLElement[]> = {};
                            
                            
                            Severity: Minor
                            Found in resources/js/services/components.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 (siblingDOM != null) {
                                        dom.insertBefore(childDOM, siblingDOM);
                                      } else {
                                        dom.appendChild(childDOM);
                                      }
                            Severity: Major
                            Found in resources/js/wysiwyg/lexical/core/LexicalReconciler.ts - About 45 mins to fix

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

                                mergeWithSibling(target: TextNode): TextNode {
                                  const isBefore = target === this.getPreviousSibling();
                                  if (!isBefore && target !== this.getNextSibling()) {
                                    invariant(
                                      false,
                              Severity: Minor
                              Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.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 (canUseFastPath) {
                                        // Fast path for removing DOM nodes
                                        dom.textContent = '';
                                      }
                              Severity: Major
                              Found in resources/js/wysiwyg/lexical/core/LexicalReconciler.ts - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                          if (
                                            // eslint-disable-next-line no-prototype-builtins
                                            !klass.hasOwnProperty('importDOM') &&
                                            // eslint-disable-next-line no-prototype-builtins
                                            klass.hasOwnProperty('exportDOM')
                                Severity: Major
                                Found in resources/js/wysiwyg/lexical/core/LexicalEditor.ts - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                            if (
                                              // eslint-disable-next-line no-prototype-builtins
                                              !klass.hasOwnProperty('importJSON')
                                            ) {
                                              console.warn(
                                  Severity: Major
                                  Found in resources/js/wysiwyg/lexical/core/LexicalEditor.ts - About 45 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language