BookStackApp/BookStack

View on GitHub

Showing 889 of 1,485 total issues

Function resolveSelectionPointOnBoundary has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function resolveSelectionPointOnBoundary(
  point: TextPointType,
  isBackward: boolean,
  isCollapsed: boolean,
): void {
Severity: Major
Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 2 hrs to fix

    Function setTextThemeClassNames has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function setTextThemeClassNames(
      tag: string,
      prevFormat: number,
      nextFormat: number,
      dom: HTMLElement,
    Severity: Major
    Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 2 hrs to fix

      File TrashCan.php has 251 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace BookStack\Entities\Tools;
      
      use BookStack\Entities\EntityProvider;
      Severity: Minor
      Found in app/Entities/Tools/TrashCan.php - About 2 hrs to fix

        Consider simplifying this complex logical expression.
        Open

                if ($model instanceof Page) {
                    $parentPermission = ($currentParent instanceof Chapter) ? 'chapter-update' : 'book-update';
                    $hasCurrentParentPermission = userCan($parentPermission, $currentParent);
        
                    // This needs to check if there was an intended chapter location in the original sort map
        Severity: Critical
        Found in app/Entities/Tools/BookContents.php - About 2 hrs to fix

          Function deleteTextHandler has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const deleteTextHandler = (command: LexicalCommand<boolean>) => () => {
              const selection = $getSelection();
          
              if (!$isSelectionInTable(selection, tableNode)) {
                return false;
          Severity: Minor
          Found in resources/js/wysiwyg/lexical/table/LexicalTableSelectionHelpers.ts - About 2 hrs to fix

            Function onDocumentSelectionChange has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function onDocumentSelectionChange(event: Event): void {
              const target = event.target as null | Element | Document;
              const targetWindow =
                target == null
                  ? null
            Severity: Minor
            Found in resources/js/wysiwyg/lexical/core/LexicalEvents.ts - About 2 hrs to fix

              Function importDOM has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                static importDOM(): DOMConversionMap | null {
                  return {
                    h1: (node: Node) => ({
                      conversion: $convertHeadingElement,
                      priority: 0,
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/rich-text/index.ts - About 2 hrs to fix

                Function updateDOMBlockCursorElement has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function updateDOMBlockCursorElement(
                  editor: LexicalEditor,
                  rootElement: HTMLElement,
                  nextSelection: null | BaseSelection,
                ): void {
                Severity: Minor
                Found in resources/js/wysiwyg/lexical/core/LexicalUtils.ts - About 2 hrs to fix

                  Function init has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export async function init(editor) {
                      const Code = await window.importVersioned('code');
                  
                      /**
                       * @param {ViewUpdate} v
                  Severity: Minor
                  Found in resources/js/markdown/codemirror.js - About 1 hr to fix

                    Method processAccessTokenCallback has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function processAccessTokenCallback(OidcAccessToken $accessToken, OidcProviderSettings $settings): User
                        {
                            $idTokenText = $accessToken->getIdToken();
                            $idToken = new OidcIdToken(
                                $idTokenText,
                    Severity: Minor
                    Found in app/Access/Oidc/OidcService.php - About 1 hr to fix

                      Function position has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        function position(): void {
                          invariant(rootDOMNode !== null, 'Unexpected null rootDOMNode');
                          invariant(parentDOMNode !== null, 'Unexpected null parentDOMNode');
                          const {left: rootLeft, top: rootTop} = rootDOMNode.getBoundingClientRect();
                          const parentDOMNode_ = parentDOMNode;
                      Severity: Minor
                      Found in resources/js/wysiwyg/lexical/utils/positionNodeOnRange.ts - About 1 hr to fix

                        Function $appendNodesToJSON has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function $appendNodesToJSON(
                          editor: LexicalEditor,
                          selection: BaseSelection | null,
                          currentNode: LexicalNode,
                          targetArray: Array<BaseSerializedNode> = [],
                        Severity: Minor
                        Found in resources/js/wysiwyg/lexical/clipboard/clipboard.ts - About 1 hr to fix

                          Function $insertDataTransferForRichText has 49 lines of code (exceeds 25 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 1 hr to fix

                            Function $handleIndent has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function $handleIndent(listItemNode: ListItemNode): void {
                              // go through each node and decide where to move it.
                              const removed = new Set<NodeKey>();
                            
                              if (isNestedListNode(listItemNode) || removed.has(listItemNode.getKey())) {
                            Severity: Minor
                            Found in resources/js/wysiwyg/lexical/list/formatList.ts - About 1 hr to fix

                              Function onClick has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function onClick(event: PointerEvent, editor: LexicalEditor): void {
                                updateEditor(editor, () => {
                                  const selection = $getSelection();
                                  const domSelection = getDOMSelection(editor._window);
                                  const lastSelection = $getPreviousSelection();
                              Severity: Minor
                              Found in resources/js/wysiwyg/lexical/core/LexicalEvents.ts - About 1 hr to fix

                                Function applyTextFormatFromStyle has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function applyTextFormatFromStyle(
                                  style: CSSStyleDeclaration,
                                  shouldApply?: TextFormatType,
                                ) {
                                  const fontWeight = style.fontWeight;
                                Severity: Minor
                                Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 1 hr to fix

                                  Method build has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function build(): array
                                      {
                                          // Note, while we attempt to use the user's preference here, the request to the manifest
                                          // does not start a session, so we won't have current user context.
                                          // This was attempted but removed since manifest calls could affect user session
                                  Severity: Minor
                                  Found in app/App/PwaManifestBuilder.php - About 1 hr to fix

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

                                    export function register(editor) {
                                        // Headers
                                        for (let i = 1; i < 5; i++) {
                                            editor.shortcuts.add(`meta+${i}`, '', ['FormatBlock', false, `h${i + 1}`]);
                                        }
                                    Severity: Minor
                                    Found in resources/js/wysiwyg-tinymce/shortcuts.js - About 1 hr to fix

                                      Function buildEditorUI has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      export function buildEditorUI(container: HTMLElement, element: HTMLElement, scrollContainer: HTMLElement, editor: LexicalEditor, options: Record<string, any>): EditorUiContext {
                                          const manager = new EditorUIManager();
                                          const context: EditorUiContext = {
                                              editor,
                                              containerDOM: container,
                                      Severity: Minor
                                      Found in resources/js/wysiwyg/ui/index.ts - About 1 hr to fix

                                        Function build has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                                    build() {
                                                        const generalFields: EditorFormFieldDefinition[] = [
                                                            {
                                                                label: 'Width', // Style - width
                                                                name: 'width',
                                        Severity: Minor
                                        Found in resources/js/wysiwyg/ui/defaults/forms/tables.ts - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language