BookStackApp/BookStack

View on GitHub

Showing 1,485 of 1,485 total issues

File LexicalSelectionHelpers.test.ts has 2520 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.

    File LexicalSelection.ts has 2308 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * Copyright (c) Meta Platforms, Inc. and affiliates.
     *
     * This source code is licensed under the MIT license found in the
     * LICENSE file in the root directory of this source tree.
    Severity: Major
    Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 6 days to fix

      File LexicalTableSelectionHelpers.ts has 1595 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /**
       * Copyright (c) Meta Platforms, Inc. and affiliates.
       *
       * This source code is licensed under the MIT license found in the
       * LICENSE file in the root directory of this source tree.
      Severity: Major
      Found in resources/js/wysiwyg/lexical/table/LexicalTableSelectionHelpers.ts - About 4 days to fix

        File LexicalUtils.ts has 1523 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * Copyright (c) Meta Platforms, Inc. and affiliates.
         *
         * This source code is licensed under the MIT license found in the
         * LICENSE file in the root directory of this source tree.
        Severity: Major
        Found in resources/js/wysiwyg/lexical/core/LexicalUtils.ts - About 4 days to fix

          Function applyTableHandlers has 709 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function applyTableHandlers(
            tableNode: TableNode,
            tableElement: HTMLTableElementWithWithTableSelectionState,
            editor: LexicalEditor,
            hasTabHandler: boolean,
          Severity: Major
          Found in resources/js/wysiwyg/lexical/table/LexicalTableSelectionHelpers.ts - About 3 days to fix

            File LexicalNode.test.ts has 1268 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /**
             * Copyright (c) Meta Platforms, Inc. and affiliates.
             *
             * This source code is licensed under the MIT license found in the
             * LICENSE file in the root directory of this source tree.
            Severity: Major
            Found in resources/js/wysiwyg/lexical/core/__tests__/unit/LexicalNode.test.ts - About 3 days to fix

              Function insertText has a Cognitive Complexity of 149 (exceeds 5 allowed). Consider refactoring.
              Open

                insertText(text: string): void {
                  const anchor = this.anchor;
                  const focus = this.focus;
                  const format = this.format;
                  const style = this.style;
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 3 days 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

              File LexicalListItemNode.test.ts has 1174 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /**
               * Copyright (c) Meta Platforms, Inc. and affiliates.
               *
               * This source code is licensed under the MIT license found in the
               * LICENSE file in the root directory of this source tree.

                Function $handleArrowKey has a Cognitive Complexity of 143 (exceeds 5 allowed). Consider refactoring.
                Open

                function $handleArrowKey(
                  editor: LexicalEditor,
                  event: KeyboardEvent,
                  direction: Direction,
                  tableNode: TableNode,
                Severity: Minor
                Found in resources/js/wysiwyg/lexical/table/LexicalTableSelectionHelpers.ts - About 2 days 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

                File LexicalEvents.ts has 1106 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /**
                 * Copyright (c) Meta Platforms, Inc. and affiliates.
                 *
                 * This source code is licensed under the MIT license found in the
                 * LICENSE file in the root directory of this source tree.
                Severity: Major
                Found in resources/js/wysiwyg/lexical/core/LexicalEvents.ts - About 2 days to fix

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

                  export function removeFromParent(node: LexicalNode): void {
                    const oldParent = node.getParent();
                    if (oldParent !== null) {
                      const writableNode = node.getWritable();
                      const writableParent = oldParent.getWritable();
                  Severity: Major
                  Found in resources/js/wysiwyg/lexical/core/LexicalUtils.ts and 1 other location - About 2 days to fix
                  resources/js/wysiwyg/lexical/yjs/Utils.ts on lines 477..526

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

                  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

                  export function removeFromParent(node: LexicalNode): void {
                    const oldParent = node.getParent();
                    if (oldParent !== null) {
                      const writableNode = node.getWritable();
                      const writableParent = oldParent.getWritable();
                  Severity: Major
                  Found in resources/js/wysiwyg/lexical/yjs/Utils.ts and 1 other location - About 2 days to fix
                  resources/js/wysiwyg/lexical/core/LexicalUtils.ts on lines 313..362

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

                  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

                  File LexicalTextNode.ts has 1044 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /**
                   * Copyright (c) Meta Platforms, Inc. and affiliates.
                   *
                   * This source code is licensed under the MIT license found in the
                   * LICENSE file in the root directory of this source tree.
                  Severity: Major
                  Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 2 days to fix

                    Function registerRichText has 490 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function registerRichText(editor: LexicalEditor): () => void {
                      const removeListener = mergeRegister(
                        editor.registerCommand(
                          CLICK_COMMAND,
                          (payload) => {
                    Severity: Major
                    Found in resources/js/wysiwyg/lexical/rich-text/index.ts - About 2 days to fix

                      File index.ts has 954 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /**
                       * Copyright (c) Meta Platforms, Inc. and affiliates.
                       *
                       * This source code is licensed under the MIT license found in the
                       * LICENSE file in the root directory of this source tree.
                      Severity: Major
                      Found in resources/js/wysiwyg/lexical/rich-text/index.ts - About 2 days to fix

                        File LexicalEditor.ts has 867 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /**
                         * Copyright (c) Meta Platforms, Inc. and affiliates.
                         *
                         * This source code is licensed under the MIT license found in the
                         * LICENSE file in the root directory of this source tree.
                        Severity: Major
                        Found in resources/js/wysiwyg/lexical/core/LexicalEditor.ts - About 2 days to fix

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

                              test('Has correct text point after removal after merge (2)', async () => {
                                const editor = createTestEditor();
                          
                                const domElement = document.createElement('div');
                                let element;
                          resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 626..700

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

                          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

                              test('Has correct text point after removal of an empty text node in a group #3', async () => {
                                const editor = createTestEditor();
                          
                                const domElement = document.createElement('div');
                                let element;
                          resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 347..421

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

                          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

                              test('Has correct element point after merge from end', async () => {
                                const editor = createTestEditor();
                          
                                const domElement = document.createElement('div');
                                let element;
                          resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1145..1214

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

                          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

                              test('Has correct element point after merge from middle', async () => {
                                const editor = createTestEditor();
                          
                                const domElement = document.createElement('div');
                                let element;
                          resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1216..1285

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

                          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