BookStackApp/BookStack

View on GitHub
resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts

Summary

Maintainability
F
2 wks
Test Coverage

Function modify has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring.
Open

  Selection.prototype.modify = function (alter, direction, granularity) {
    // This is not a thorough implementation, it was more to get tests working
    // given the refactor to use this selection method.
    const symbol = Object.getOwnPropertySymbols(this)[0];
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
Severity: Minor
Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 1 day 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 index.ts has 780 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/selection/__tests__/utils/index.ts - About 1 day to fix

    Function applySelectionInputs has 202 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export async function applySelectionInputs(
      // eslint-disable-next-line @typescript-eslint/no-explicit-any
      inputs: Record<string, any>[],
      update: (fn: () => void) => Promise<void>,
      editor: LexicalEditor,
    Severity: Major
    Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 1 day to fix

      Function modify has 111 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        Selection.prototype.modify = function (alter, direction, granularity) {
          // This is not a thorough implementation, it was more to get tests working
          // given the refactor to use this selection method.
          const symbol = Object.getOwnPropertySymbols(this)[0];
          // eslint-disable-next-line @typescript-eslint/no-explicit-any
      Severity: Major
      Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 4 hrs to fix

        Function moveNativeSelectionBackward has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

        function moveNativeSelectionBackward() {
          const domSelection = window.getSelection()!;
          let anchorNode = domSelection.anchorNode!;
          let anchorOffset = domSelection.anchorOffset!;
        
        
        Severity: Minor
        Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.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 moveNativeSelectionForward has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        function moveNativeSelectionForward() {
          const domSelection = window.getSelection()!;
          const anchorNode = domSelection.anchorNode!;
          const anchorOffset = domSelection.anchorOffset!;
        
        
        Severity: Minor
        Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.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 moveNativeSelectionBackward has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function moveNativeSelectionBackward() {
          const domSelection = window.getSelection()!;
          let anchorNode = domSelection.anchorNode!;
          let anchorOffset = domSelection.anchorOffset!;
        
        
        Severity: Major
        Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 2 hrs to fix

          Function getWordsFromString has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

            const getWordsFromString = function (string: string): Array<Segment> {
              const segments: Segment[] = [];
              let wordString = '';
              let nonWordString = '';
              let i;
          Severity: Minor
          Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.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 moveNativeSelectionForward has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function moveNativeSelectionForward() {
            const domSelection = window.getSelection()!;
            const anchorNode = domSelection.anchorNode!;
            const anchorOffset = domSelection.anchorOffset!;
          
          
          Severity: Minor
          Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 1 hr to fix

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

            function getLastTextNode(startingNode: Node) {
              let node = startingNode;
            
              mainLoop: while (node !== null) {
                if (node !== startingNode && node.nodeType === 3) {
            Severity: Minor
            Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.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 getNextTextNode has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            function getNextTextNode(startingNode: Node) {
              let node = startingNode;
            
              mainLoop: while (node !== null) {
                if (node !== startingNode && node.nodeType === 3) {
            Severity: Minor
            Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.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 getWordsFromString has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const getWordsFromString = function (string: string): Array<Segment> {
                const segments: Segment[] = [];
                let wordString = '';
                let nonWordString = '';
                let i;
            Severity: Minor
            Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 1 hr to fix

              Function getLastTextNode has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function getLastTextNode(startingNode: Node) {
                let node = startingNode;
              
                mainLoop: while (node !== null) {
                  if (node !== startingNode && node.nodeType === 3) {
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 1 hr to fix

                Function getNextTextNode has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function getNextTextNode(startingNode: Node) {
                  let node = startingNode;
                
                  mainLoop: while (node !== null) {
                    if (node !== startingNode && node.nodeType === 3) {
                Severity: Minor
                Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                                if ($isTextNode(anchorNode)) {
                                  anchorNode.select();
                                }
                  Severity: Major
                  Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                              if (prevSibling.nodeName === 'P') {
                                prevSibling = prevSibling.firstChild;
                              }
                    Severity: Major
                    Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                if (nextTextNode === null) {
                                  throw new Error('moveNativeSelectionForward: TODO');
                                } else {
                                  setNativeSelection(nextTextNode, 0, nextTextNode, 0);
                                }
                      Severity: Major
                      Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                } else if (!_$isTextNode) {
                                  anchor.node = anchorNode.childNodes[anchorOffset - 1];
                                  anchor.offset = anchor.node.nodeValue.length - 1;
                                } else {
                                  anchor.offset--;
                        Severity: Major
                        Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                    if (lastTextNode === null) {
                                      throw new Error('moveNativeSelectionBackward: TODO');
                                    } else {
                                      const textLength = lastTextNode.nodeValue!.length;
                                      setNativeSelection(
                          Severity: Major
                          Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                      if (prevSibling === null) {
                                        prevSibling = anchorNode.parentElement.previousSibling.lastChild;
                                      }
                            Severity: Major
                            Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                        if (nextSibling.nodeName === 'BR') {
                                          anchor.node = nextSibling;
                                          anchor.offset = 0;
                                        } else {
                                          anchor.node = nextSibling.firstChild;
                              Severity: Major
                              Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                          if (prevSibling.nodeName === 'BR') {
                                            anchor.node = prevSibling;
                                            anchor.offset = 0;
                                          } else {
                                            anchor.node = prevSibling.firstChild;
                                Severity: Major
                                Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                          if (anchorNode.nodeName === 'BR') {
                                            const parentNode = anchorNode.parentNode!;
                                            const childNodes = Array.from(parentNode.childNodes);
                                            anchorOffset = childNodes.indexOf(anchorNode as ChildNode);
                                            anchorNode = parentNode;
                                  Severity: Major
                                  Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                              if (nextSibling === null) {
                                                nextSibling = anchorNode.parentElement.nextSibling.lastChild;
                                              }
                                    Severity: Major
                                    Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                              for (let i = 0; i < segmentsLength; i++) {
                                                const segment = segments[i];
                                                const nextIndex = segment.index + segment.segment.length;
                                      
                                                if (segment.isWordLike) {
                                      Severity: Major
                                      Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                for (let i = segmentsLength - 1; i >= 0; i--) {
                                                  const segment = segments[i];
                                                  const nextIndex = segment.index;
                                        
                                                  if (segment.isWordLike) {
                                        Severity: Major
                                        Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                    if (nextSibling.nodeName === 'P') {
                                                      nextSibling = nextSibling.lastChild;
                                                    }
                                          Severity: Major
                                          Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 45 mins to fix

                                            Consider simplifying this complex logical expression.
                                            Open

                                                    if (
                                                      (_$isTextNode && anchorOffset === anchorNode.textContent.length) ||
                                                      (!_$isTextNode &&
                                                        (anchorNode.childNodes.length === anchorOffset ||
                                                          (anchorNode.childNodes.length === 1 &&
                                            Severity: Major
                                            Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 40 mins to fix

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

                                                rootElement: Node,
                                                anchorPath: number[],
                                                anchorOffset: number,
                                                focusPath: number[],
                                                focusOffset: number,
                                              Severity: Minor
                                              Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 35 mins to fix

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

                                                function getNextTextNode(startingNode: Node) {
                                                  let node = startingNode;
                                                
                                                  mainLoop: while (node !== null) {
                                                    if (node !== startingNode && node.nodeType === 3) {
                                                resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts on lines 442..479

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

                                                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

                                                function getLastTextNode(startingNode: Node) {
                                                  let node = startingNode;
                                                
                                                  mainLoop: while (node !== null) {
                                                    if (node !== startingNode && node.nodeType === 3) {
                                                resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts on lines 481..518

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

                                                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 $setAnchorPoint(
                                                  point: Pick<PointType, 'type' | 'offset' | 'key'>,
                                                ) {
                                                  const selection = $getSelection();
                                                
                                                
                                                resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts on lines 899..918

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

                                                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 $setFocusPoint(
                                                  point: Pick<PointType, 'type' | 'offset' | 'key'>,
                                                ) {
                                                  const selection = $getSelection();
                                                
                                                
                                                resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts on lines 878..897

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

                                                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 3 locations. Consider refactoring.
                                                Open

                                                          case 'paste_plain': {
                                                            rootElement.dispatchEvent(
                                                              Object.assign(
                                                                new Event('paste', {
                                                                  bubbles: true,
                                                resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts on lines 827..848
                                                resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts on lines 850..871

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

                                                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 3 locations. Consider refactoring.
                                                Open

                                                          case 'paste_html': {
                                                            rootElement.dispatchEvent(
                                                              Object.assign(
                                                                new Event('paste', {
                                                                  bubbles: true,
                                                resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts on lines 804..825
                                                resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts on lines 827..848

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

                                                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 3 locations. Consider refactoring.
                                                Open

                                                          case 'paste_lexical': {
                                                            rootElement.dispatchEvent(
                                                              Object.assign(
                                                                new Event('paste', {
                                                                  bubbles: true,
                                                resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts on lines 804..825
                                                resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts on lines 850..871

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

                                                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

                                                          case 'convert_to_segmented_node': {
                                                            const text = $createTextNode(selection.getTextContent());
                                                            text.setMode('segmented');
                                                            if ($isRangeSelection(selection)) {
                                                              selection.insertNodes([text]);
                                                resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts on lines 757..765

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

                                                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

                                                          case 'convert_to_token_node': {
                                                            const text = $createTextNode(selection.getTextContent());
                                                            text.setMode('token');
                                                            if ($isRangeSelection(selection)) {
                                                              selection.insertNodes([text]);
                                                resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts on lines 767..775

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

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                          if (segment.isWordLike) {
                                                            index = nextIndex;
                                                            foundWordNode = true;
                                                          } else if (foundWordNode) {
                                                            break;
                                                Severity: Minor
                                                Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts and 1 other location - About 30 mins to fix
                                                resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts on lines 183..190

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

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                          if (segment.isWordLike) {
                                                            index = nextIndex;
                                                            foundWordNode = true;
                                                          } else if (foundWordNode) {
                                                            break;
                                                Severity: Minor
                                                Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts and 1 other location - About 30 mins to fix
                                                resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts on lines 197..204

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

                                                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