BookStackApp/BookStack

View on GitHub

Showing 1,485 of 1,485 total issues

Function removeRootElementEvents has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function removeRootElementEvents(rootElement: HTMLElement): void {
  const doc = rootElement.ownerDocument;
  const documentRootElementsCount = rootElementsRegistered.get(doc);
  invariant(
    documentRootElementsCount !== undefined,
Severity: Minor
Found in resources/js/wysiwyg/lexical/core/LexicalEvents.ts - About 1 hr to fix

    Function $updateCaretSelectionForUnicodeCharacter has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function $updateCaretSelectionForUnicodeCharacter(
      selection: RangeSelection,
      isBackward: boolean,
    ): void {
      const anchor = selection.anchor;
    Severity: Minor
    Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 1 hr to fix

      Function $normalizeSelectionPointsForBoundaries has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function $normalizeSelectionPointsForBoundaries(
        anchor: PointType,
        focus: PointType,
        lastSelection: null | BaseSelection,
      ): void {
      Severity: Minor
      Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 1 hr to fix

        Function exportNodeToJSON has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function exportNodeToJSON<SerializedNode extends SerializedLexicalNode>(
          node: LexicalNode,
        ): SerializedNode {
          const serializedNode = node.exportJSON();
          const nodeClass = node.constructor;
        Severity: Minor
        Found in resources/js/wysiwyg/lexical/core/LexicalEditorState.ts - About 1 hr to fix

          Function $updateSelectedTextFromDOM has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function $updateSelectedTextFromDOM(
            isCompositionEnd: boolean,
            editor: LexicalEditor,
            data?: string,
          ): void {
          Severity: Minor
          Found in resources/js/wysiwyg/lexical/core/LexicalUtils.ts - About 1 hr to fix

            Function initializeConversionCache has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function initializeConversionCache(
              nodes: RegisteredNodes,
              additionalConversions?: DOMConversionMap,
            ): DOMConversionCache {
              const conversionCache = new Map();
            Severity: Minor
            Found in resources/js/wysiwyg/lexical/core/LexicalEditor.ts - About 1 hr to fix

              Function $handleIndentAndOutdent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function $handleIndentAndOutdent(
                indentOrOutdent: (block: ElementNode) => void,
              ): boolean {
                const selection = $getSelection();
                if (!$isRangeSelection(selection)) {
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/rich-text/index.ts - About 1 hr to fix

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

                <?php
                
                namespace BookStack\Console\Commands;
                
                use BookStack\References\ReferenceStore;
                Severity: Major
                Found in app/Console/Commands/RegenerateReferencesCommand.php and 1 other location - About 1 hr to fix
                app/Console/Commands/RegeneratePermissionsCommand.php on lines 1..44

                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 102.

                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

                <?php
                
                namespace BookStack\Console\Commands;
                
                use BookStack\Permissions\JointPermissionBuilder;
                Severity: Major
                Found in app/Console/Commands/RegeneratePermissionsCommand.php and 1 other location - About 1 hr to fix
                app/Console/Commands/RegenerateReferencesCommand.php on lines 1..45

                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 102.

                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

                  async function update(fn: () => void) {
                    editor.update(fn);
                    editor.commitUpdates();
                    return Promise.resolve().then();
                  }
                resources/js/wysiwyg/lexical/core/nodes/__tests__/unit/LexicalTextNode.test.ts on lines 78..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 56.

                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

                        let block1: ParagraphNode,
                          block2: ParagraphNode,
                          block3: ParagraphNode,
                          text1: TextNode,
                          text2: TextNode,
                resources/js/wysiwyg/lexical/core/__tests__/unit/LexicalNode.test.ts on lines 1294..1299

                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 56.

                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

                        this.menu.addEventListener('click', event => {
                            if (event.target.closest('[data-sort-value]') !== null) {
                                this.sortOptionClick(event);
                            }
                        });
                Severity: Major
                Found in resources/js/components/list-sort-control.js and 1 other location - About 1 hr to fix
                resources/js/components/list-sort-control.js on lines 27..31

                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 56.

                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

                        let block1: ParagraphNode,
                          block2: ParagraphNode,
                          block3: ParagraphNode,
                          text1: TextNode,
                          text2: TextNode,
                resources/js/wysiwyg/lexical/core/__tests__/unit/LexicalNode.test.ts on lines 1331..1336

                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 56.

                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

                  async function update(fn: () => void) {
                    editor.update(fn);
                    editor.commitUpdates();
                    return Promise.resolve().then();
                  }
                resources/js/wysiwyg/lexical/core/nodes/__tests__/unit/LexicalElementNode.test.ts on lines 41..45

                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 56.

                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

                        this.elem.addEventListener('click', event => {
                            if (event.target.closest('[data-sort-dir]') !== null) {
                                this.sortDirectionClick(event);
                            }
                        });
                Severity: Major
                Found in resources/js/components/list-sort-control.js and 1 other location - About 1 hr to fix
                resources/js/components/list-sort-control.js on lines 21..25

                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 56.

                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

                    let maxColumn = Math.max(
                      cellAMap.startColumn + cellAMap.cell.__colSpan - 1,
                      cellBMap.startColumn + cellBMap.cell.__colSpan - 1,
                    );
                Severity: Major
                Found in resources/js/wysiwyg/lexical/table/LexicalTableSelection.ts and 1 other location - About 1 hr to fix
                resources/js/wysiwyg/lexical/table/LexicalTableSelection.ts on lines 246..249

                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 56.

                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

                  add(key: NodeKey): void {
                    this.dirty = true;
                    this._nodes.add(key);
                    this._cachedNodes = null;
                  }
                Severity: Major
                Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts and 1 other location - About 1 hr to fix
                resources/js/wysiwyg/lexical/core/LexicalSelection.ts on lines 313..317

                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 56.

                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

                  delete(key: NodeKey): void {
                    this.dirty = true;
                    this._nodes.delete(key);
                    this._cachedNodes = null;
                  }
                Severity: Major
                Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts and 1 other location - About 1 hr to fix
                resources/js/wysiwyg/lexical/core/LexicalSelection.ts on lines 307..311

                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 56.

                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

                    let maxRow = Math.max(
                      cellAMap.startRow + cellAMap.cell.__rowSpan - 1,
                      cellBMap.startRow + cellBMap.cell.__rowSpan - 1,
                    );
                Severity: Major
                Found in resources/js/wysiwyg/lexical/table/LexicalTableSelection.ts and 1 other location - About 1 hr to fix
                resources/js/wysiwyg/lexical/table/LexicalTableSelection.ts on lines 242..245

                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 56.

                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

                        for (const cell of cells) {
                            colSize += cell.getRowSpan() || 1;
                            if (cell.getColSpan() > 1) {
                                throw Error('Cannot copy columns with merged cells');
                            }
                Severity: Major
                Found in resources/js/wysiwyg/utils/table-copy-paste.ts and 1 other location - About 1 hr to fix
                resources/js/wysiwyg/utils/table-copy-paste.ts on lines 23..28

                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 56.

                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

                Severity
                Category
                Status
                Source
                Language