BookStackApp/BookStack

View on GitHub

Showing 1,485 of 1,485 total issues

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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            if (node !== null && $isTextNode(node)) {
              if (subTreeTextFormat === null) {
                subTreeTextFormat = node.getFormat();
              }
              if (subTreeTextStyle === '') {
        Severity: Major
        Found in resources/js/wysiwyg/lexical/core/LexicalReconciler.ts and 1 other location - About 1 hr to fix
        resources/js/wysiwyg/lexical/core/LexicalReconciler.ts on lines 719..726

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 69.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            prev_book: {
                active(elem, parent, book) {
                    return book.previousElementSibling !== null;
                },
                run(elem, parent, book) {
        Severity: Major
        Found in resources/js/components/book-sort.js and 1 other location - About 1 hr to fix
        resources/js/components/book-sort.js on lines 65..73

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 69.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            next_book: {
                active(elem, parent, book) {
                    return book.nextElementSibling !== null;
                },
                run(elem, parent, book) {
        Severity: Major
        Found in resources/js/components/book-sort.js and 1 other location - About 1 hr to fix
        resources/js/components/book-sort.js on lines 74..82

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 69.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            if (node !== null && $isTextNode(node)) {
              if (subTreeTextFormat === null) {
                subTreeTextFormat = node.getFormat();
              }
              if (subTreeTextStyle === '') {
        Severity: Major
        Found in resources/js/wysiwyg/lexical/core/LexicalReconciler.ts and 1 other location - About 1 hr to fix
        resources/js/wysiwyg/lexical/core/LexicalReconciler.ts on lines 272..279

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 69.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            static importJSON(serializedNode: SerializedCustomListNode): CustomListNode {
                const node = $createCustomListNode(serializedNode.listType);
                node.setId(serializedNode.id);
                node.setDirection(serializedNode.direction);
                return node;
        Severity: Major
        Found in resources/js/wysiwyg/nodes/custom-list.ts and 1 other location - About 1 hr to fix
        resources/js/wysiwyg/lexical/rich-text/index.ts on lines 328..333

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 69.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                await editor.getEditorState().read(() => {
                  expect(textNode.getTopLevelElement()).toBe(paragraphNode);
                  expect(paragraphNode.getTopLevelElement()).toBe(paragraphNode);
                });
        resources/js/wysiwyg/lexical/core/__tests__/unit/LexicalNode.test.ts on lines 626..629

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 69.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          static importJSON(serializedNode: SerializedHeadingNode): HeadingNode {
            const node = $createHeadingNode(serializedNode.tag);
            node.setFormat(serializedNode.format);
            node.setIndent(serializedNode.indent);
            return node;
        Severity: Major
        Found in resources/js/wysiwyg/lexical/rich-text/index.ts and 1 other location - About 1 hr to fix
        resources/js/wysiwyg/nodes/custom-list.ts on lines 67..72

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 69.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          getFirstChildOrThrow<T extends LexicalNode>(): T {
            const firstChild = this.getFirstChild<T>();
            if (firstChild === null) {
              invariant(false, 'Expected node %s to have a first child.', this.__key);
            }
        resources/js/wysiwyg/lexical/core/nodes/LexicalElementNode.ts on lines 232..238

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 69.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          getLastChildOrThrow<T extends LexicalNode>(): T {
            const lastChild = this.getLastChild<T>();
            if (lastChild === null) {
              invariant(false, 'Expected node %s to have a last child.', this.__key);
            }
        resources/js/wysiwyg/lexical/core/nodes/LexicalElementNode.ts on lines 220..226

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 69.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                await editor.getEditorState().read(() => {
                  expect(textNode.getTopLevelElementOrThrow()).toBe(paragraphNode);
                  expect(paragraphNode.getTopLevelElementOrThrow()).toBe(paragraphNode);
                });
        resources/js/wysiwyg/lexical/core/__tests__/unit/LexicalNode.test.ts on lines 587..590

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 69.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

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

            function $setListItemThemeClassNames(
              dom: HTMLElement,
              editorThemeClasses: EditorThemeClasses,
              node: ListItemNode,
            ): void {
            Severity: Minor
            Found in resources/js/wysiwyg/lexical/list/LexicalListItemNode.ts - About 1 hr to fix

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

              export function $handleOutdent(listItemNode: ListItemNode): void {
                // go through each node and decide where to move it.
              
                if (isNestedListNode(listItemNode)) {
                  return;
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/list/formatList.ts - About 1 hr to fix

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

                  getShape(): TableSelectionShape {
                    const anchorCellNode = $getNodeByKey(this.anchor.key);
                    invariant(
                      $isTableCellNode(anchorCellNode),
                      'Expected TableSelection anchor to be (or a child of) TableCellNode',
                Severity: Minor
                Found in resources/js/wysiwyg/lexical/table/LexicalTableSelection.ts - About 1 hr to fix

                  Function setup has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      setup() {
                          // Options
                          this.draftsEnabled = this.$opts.draftsEnabled === 'true';
                          this.editorType = this.$opts.editorType;
                          this.pageId = Number(this.$opts.pageId);
                  Severity: Minor
                  Found in resources/js/components/page-editor.js - About 1 hr to fix

                    Function $internalResolveSelectionPoints has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function $internalResolveSelectionPoints(
                      anchorDOM: null | Node,
                      anchorOffset: number,
                      focusDOM: null | Node,
                      focusOffset: number,
                    Severity: Minor
                    Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language