BookStackApp/BookStack

View on GitHub
resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts

Summary

Maintainability
F
1 wk
Test Coverage

File LexicalTableUtils.ts has 790 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/LexicalTableUtils.ts - About 1 day to fix

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

    export function $unmergeCell(): void {
      const selection = $getSelection();
      invariant(
        $isRangeSelection(selection) || $isTableSelection(selection),
        'Expected a RangeSelection or TableSelection',
    Severity: Minor
    Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 4 hrs 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

    Function $insertTableColumn__EXPERIMENTAL has 94 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function $insertTableColumn__EXPERIMENTAL(insertAfter = true): void {
      const selection = $getSelection();
      invariant(
        $isRangeSelection(selection) || $isTableSelection(selection),
        'Expected a RangeSelection or TableSelection',
    Severity: Major
    Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 3 hrs to fix

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

      export function $insertTableColumn__EXPERIMENTAL(insertAfter = true): void {
        const selection = $getSelection();
        invariant(
          $isRangeSelection(selection) || $isTableSelection(selection),
          'Expected a RangeSelection or TableSelection',
      Severity: Minor
      Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 3 hrs 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

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

      export function $createTableNodeWithDimensions(
        rowCount: number,
        columnCount: number,
        includeHeaders: InsertTableCommandPayloadHeaders = true,
      ): TableNode {
      Severity: Minor
      Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 3 hrs 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

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

      export function $deleteTableColumn__EXPERIMENTAL(): void {
        const selection = $getSelection();
        invariant(
          $isRangeSelection(selection) || $isTableSelection(selection),
          'Expected a RangeSelection or TableSelection',
      Severity: Minor
      Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 3 hrs 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

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

      export function $insertTableRow(
        tableNode: TableNode,
        targetIndex: number,
        shouldInsertAfter = true,
        rowCount: number,
      Severity: Minor
      Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 3 hrs 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

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

      export function $deleteTableRow__EXPERIMENTAL(): void {
        const selection = $getSelection();
        invariant(
          $isRangeSelection(selection) || $isTableSelection(selection),
          'Expected a RangeSelection or TableSelection',
      Severity: Minor
      Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 2 hrs 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

      Function $deleteTableRow__EXPERIMENTAL has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function $deleteTableRow__EXPERIMENTAL(): void {
        const selection = $getSelection();
        invariant(
          $isRangeSelection(selection) || $isTableSelection(selection),
          'Expected a RangeSelection or TableSelection',
      Severity: Major
      Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 2 hrs to fix

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

        export function $computeTableMapSkipCellCheck(
          grid: TableNode,
          cellA: null | TableCellNode,
          cellB: null | TableCellNode,
        ): [TableMapType, TableMapValueType | null, TableMapValueType | null] {
        Severity: Minor
        Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 2 hrs 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

        Function $deleteTableColumn__EXPERIMENTAL has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function $deleteTableColumn__EXPERIMENTAL(): void {
          const selection = $getSelection();
          invariant(
            $isRangeSelection(selection) || $isTableSelection(selection),
            'Expected a RangeSelection or TableSelection',
        Severity: Major
        Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 2 hrs to fix

          Function $unmergeCell has 63 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function $unmergeCell(): void {
            const selection = $getSelection();
            invariant(
              $isRangeSelection(selection) || $isTableSelection(selection),
              'Expected a RangeSelection or TableSelection',
          Severity: Major
          Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 2 hrs to fix

            Function $insertTableRow__EXPERIMENTAL has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function $insertTableRow__EXPERIMENTAL(insertAfter = true): void {
              const selection = $getSelection();
              invariant(
                $isRangeSelection(selection) || $isTableSelection(selection),
                'Expected a RangeSelection or TableSelection',
            Severity: Major
            Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 2 hrs to fix

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

              export function $insertTableColumn(
                tableNode: TableNode,
                targetIndex: number,
                shouldInsertAfter = true,
                columnCount: number,
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 2 hrs 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

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

              export function $getTableCellNodeRect(tableCellNode: TableCellNode): {
                rowIndex: number;
                columnIndex: number;
                rowSpan: number;
                colSpan: number;
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 2 hrs 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

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

              export function $computeTableMapSkipCellCheck(
                grid: TableNode,
                cellA: null | TableCellNode,
                cellB: null | TableCellNode,
              ): [TableMapType, TableMapValueType | null, TableMapValueType | null] {
              Severity: Major
              Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 2 hrs to fix

                Function $insertTableRow has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function $insertTableRow(
                  tableNode: TableNode,
                  targetIndex: number,
                  shouldInsertAfter = true,
                  rowCount: number,
                Severity: Minor
                Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 1 hr to fix

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

                  export function $insertTableRow__EXPERIMENTAL(insertAfter = true): void {
                    const selection = $getSelection();
                    invariant(
                      $isRangeSelection(selection) || $isTableSelection(selection),
                      'Expected a RangeSelection or TableSelection',
                  Severity: Minor
                  Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 1 hr 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

                  Function $insertTableColumn has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function $insertTableColumn(
                    tableNode: TableNode,
                    targetIndex: number,
                    shouldInsertAfter = true,
                    columnCount: number,
                  Severity: Minor
                  Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 1 hr to fix

                    Function $getTableCellNodeRect has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function $getTableCellNodeRect(tableCellNode: TableCellNode): {
                      rowIndex: number;
                      columnIndex: number;
                      rowSpan: number;
                      colSpan: number;
                    Severity: Minor
                    Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 1 hr to fix

                      Function $getNodeTriplet has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function $getNodeTriplet(
                        source: PointType | LexicalNode | TableCellNode,
                      ): [TableCellNode, TableRowNode, TableNode] {
                        let cell: TableCellNode;
                        if (source instanceof TableCellNode) {
                      Severity: Minor
                      Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 1 hr to fix

                        Function $createTableNodeWithDimensions has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function $createTableNodeWithDimensions(
                          rowCount: number,
                          columnCount: number,
                          includeHeaders: InsertTableCommandPayloadHeaders = true,
                        ): TableNode {
                        Severity: Minor
                        Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 1 hr to fix

                          Avoid deeply nested control flow statements.
                          Open

                                  if (iColumn === 0) {
                                    headerState |= TableCellHeaderStates.COLUMN;
                                  }
                          Severity: Major
                          Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                    if (column === endColumn) {
                                      // Overflowing right
                                      const inSelectedArea = endColumn - cellStartColumn + 1;
                                      cell.setColSpan(cell.__colSpan - inSelectedArea);
                                    }
                            Severity: Major
                            Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                      if (iRow === 0) {
                                        headerState |= TableCellHeaderStates.ROW;
                                      }
                              Severity: Major
                              Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 45 mins to fix

                                Function $insertTableRow has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                  tableNode: TableNode,
                                  targetIndex: number,
                                  shouldInsertAfter = true,
                                  rowCount: number,
                                  table: TableDOMTable,
                                Severity: Minor
                                Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 35 mins to fix

                                  Function $insertTableColumn has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                    tableNode: TableNode,
                                    targetIndex: number,
                                    shouldInsertAfter = true,
                                    columnCount: number,
                                    table: TableDOMTable,
                                  Severity: Minor
                                  Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 35 mins to fix

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

                                    export function $deleteTableColumn(
                                      tableNode: TableNode,
                                      targetIndex: number,
                                    ): TableNode {
                                      const tableRows = tableNode.getChildren();
                                    Severity: Minor
                                    Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 35 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

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

                                          if (startRow === focusStartRow) {
                                            const currentCell = focusStartRowMap[i].cell as TableCellNode;
                                            const currentCellHeaderState = currentCell.__headerState;
                                    
                                            const headerState = getHeaderState(
                                    Severity: Major
                                    Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts and 1 other location - About 2 hrs to fix
                                    resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts on lines 265..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 78.

                                    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

                                          if (startRow + cell.__rowSpan - 1 <= focusEndRow) {
                                            const currentCell = focusEndRowMap[i].cell as TableCellNode;
                                            const currentCellHeaderState = currentCell.__headerState;
                                    
                                            const headerState = getHeaderState(
                                    Severity: Major
                                    Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts and 1 other location - About 2 hrs to fix
                                    resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts on lines 292..306

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

                                    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

                                    function $insertFirst(parent: ElementNode, node: LexicalNode): void {
                                      const firstChild = parent.getFirstChild();
                                      if (firstChild !== null) {
                                        firstChild.insertBefore(node);
                                      } else {
                                    Severity: Major
                                    Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts and 1 other location - About 2 hrs to fix
                                    resources/js/wysiwyg/lexical/utils/index.ts on lines 576..583

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

                                    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

                                    export function $getTableNodeFromLexicalNodeOrThrow(
                                      startingNode: LexicalNode,
                                    ): TableNode {
                                      const node = $findMatchingParent(startingNode, (n) => $isTableNode(n));
                                    
                                    
                                    Severity: Major
                                    Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts and 1 other location - About 1 hr to fix
                                    resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts on lines 93..103

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

                                    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

                                    export function $getTableRowNodeFromTableCellNodeOrThrow(
                                      startingNode: LexicalNode,
                                    ): TableRowNode {
                                      const node = $findMatchingParent(startingNode, (n) => $isTableRowNode(n));
                                    
                                    
                                    Severity: Major
                                    Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts and 1 other location - About 1 hr to fix
                                    resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts on lines 105..115

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

                                    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

                                            if (
                                              (left && left.hasHeaderState(TableCellHeaderStates.ROW)) ||
                                              (right && right.hasHeaderState(TableCellHeaderStates.ROW))
                                            ) {
                                              headerState |= TableCellHeaderStates.ROW;
                                    Severity: Minor
                                    Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts and 1 other location - About 55 mins to fix
                                    resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts on lines 208..213

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

                                    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

                                            if (
                                              (above && above.hasHeaderState(TableCellHeaderStates.COLUMN)) ||
                                              (below && below.hasHeaderState(TableCellHeaderStates.COLUMN))
                                            ) {
                                              headerState |= TableCellHeaderStates.COLUMN;
                                    Severity: Minor
                                    Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts and 1 other location - About 55 mins to fix
                                    resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts on lines 348..353

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

                                    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 (let i = 1; i < colSpan; i++) {
                                          cell.insertAfter(
                                            $createTableCellNode(TableCellHeaderStates.NO_STATUS).append(
                                              $createParagraphNode(),
                                            ),
                                    Severity: Minor
                                    Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts and 1 other location - About 55 mins to fix
                                    resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts on lines 719..725

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

                                    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 (let j = 0; j < colSpan; j++) {
                                              insertAfterCell.insertAfter(
                                                $createTableCellNode(TableCellHeaderStates.NO_STATUS).append(
                                                  $createParagraphNode(),
                                                ),
                                    Severity: Minor
                                    Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts and 1 other location - About 55 mins to fix
                                    resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts on lines 677..683

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

                                    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 (let j = 0; j < colSpan; j++) {
                                              cellMatrix[rowIndex + i][columnIndex + j] = cell;
                                            }
                                    Severity: Minor
                                    Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts and 1 other location - About 35 mins to fix
                                    resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts on lines 767..769

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

                                    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 (let j = 0; j < colSpan; j++) {
                                            tableMap[startRow + i][startColumn + j] = value;
                                          }
                                    Severity: Minor
                                    Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts and 1 other location - About 35 mins to fix
                                    resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts on lines 874..876

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

                                    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

                                    There are no issues that match your filters.

                                    Category
                                    Status