BookStackApp/BookStack

View on GitHub
resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts

Summary

Maintainability
F
1 wk
Test Coverage

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

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

    TextNode has 42 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class TextNode extends LexicalNode {
      ['constructor']!: KlassConstructor<typeof TextNode>;
      __text: string;
      /** @internal */
      __format: number;
    Severity: Minor
    Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 5 hrs to fix

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

      function $convertTextDOMNode(domNode: Node): DOMConversionOutput {
        const domNode_ = domNode as Text;
        const parentDom = domNode.parentElement;
        invariant(
          parentDom !== null,
      Severity: Minor
      Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 5 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 setTextThemeClassNames has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

      function setTextThemeClassNames(
        tag: string,
        prevFormat: number,
        nextFormat: number,
        dom: HTMLElement,
      Severity: Minor
      Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.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 splitText has 104 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        splitText(...splitOffsets: Array<number>): Array<TextNode> {
          errorOnReadOnly();
          const self = this.getLatest();
          const textContent = self.getTextContent();
          const key = self.__key;
      Severity: Major
      Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 4 hrs to fix

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

          splitText(...splitOffsets: Array<number>): Array<TextNode> {
            errorOnReadOnly();
            const self = this.getLatest();
            const textContent = self.getTextContent();
            const key = self.__key;
        Severity: Minor
        Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.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 findTextInLine has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

        function findTextInLine(text: Text, forward: boolean): null | Text {
          let node: Node = text;
          // eslint-disable-next-line no-constant-condition
          while (true) {
            let sibling: null | Node;
        Severity: Minor
        Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.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 $convertTextDOMNode has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function $convertTextDOMNode(domNode: Node): DOMConversionOutput {
          const domNode_ = domNode as Text;
          const parentDom = domNode.parentElement;
          invariant(
            parentDom !== null,
        Severity: Major
        Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 2 hrs to fix

          Function updateDOM has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            updateDOM(
              prevNode: TextNode,
              dom: HTMLElement,
              config: EditorConfig,
            ): boolean {
          Severity: Major
          Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 2 hrs to fix

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

            function setTextThemeClassNames(
              tag: string,
              prevFormat: number,
              nextFormat: number,
              dom: HTMLElement,
            Severity: Major
            Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 2 hrs to fix

              Function applyTextFormatFromStyle has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function applyTextFormatFromStyle(
                style: CSSStyleDeclaration,
                shouldApply?: TextFormatType,
              ) {
                const fontWeight = style.fontWeight;
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 1 hr to fix

                Function importDOM has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  static importDOM(): DOMConversionMap | null {
                    return {
                      '#text': () => ({
                        conversion: $convertTextDOMNode,
                        priority: 0,
                Severity: Minor
                Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 1 hr to fix

                  Function mergeWithSibling has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    mergeWithSibling(target: TextNode): TextNode {
                      const isBefore = target === this.getPreviousSibling();
                      if (!isBefore && target !== this.getNextSibling()) {
                        invariant(
                          false,
                  Severity: Minor
                  Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 1 hr to fix

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

                      updateDOM(
                        prevNode: TextNode,
                        dom: HTMLElement,
                        config: EditorConfig,
                      ): boolean {
                    Severity: Minor
                    Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.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 setTextContent has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function setTextContent(
                      nextText: string,
                      dom: HTMLElement,
                      node: TextNode,
                    ): void {
                    Severity: Minor
                    Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.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 select has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      select(_anchorOffset?: number, _focusOffset?: number): RangeSelection {
                        errorOnReadOnly();
                        let anchorOffset = _anchorOffset;
                        let focusOffset = _focusOffset;
                        const selection = $getSelection();
                    Severity: Minor
                    Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 1 hr to fix

                      Function exportDOM has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        exportDOM(editor: LexicalEditor): DOMExportOutput {
                          let {element} = super.exportDOM(editor);
                          invariant(
                            element !== null && isHTMLElement(element),
                            'Expected TextNode createDOM to always return a HTMLElement',
                      Severity: Minor
                      Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 1 hr to fix

                        Function findTextInLine has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function findTextInLine(text: Text, forward: boolean): null | Text {
                          let node: Node = text;
                          // eslint-disable-next-line no-constant-condition
                          while (true) {
                            let sibling: null | Node;
                        Severity: Minor
                        Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 1 hr to fix

                          Function select has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            select(_anchorOffset?: number, _focusOffset?: number): RangeSelection {
                              errorOnReadOnly();
                              let anchorOffset = _anchorOffset;
                              let focusOffset = _focusOffset;
                              const selection = $getSelection();
                          Severity: Minor
                          Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.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 exportDOM has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                            exportDOM(editor: LexicalEditor): DOMExportOutput {
                              let {element} = super.exportDOM(editor);
                              invariant(
                                element !== null && isHTMLElement(element),
                                'Expected TextNode createDOM to always return a HTMLElement',
                          Severity: Minor
                          Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.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 createTextInnerDOM has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            innerDOM: HTMLElement,
                            node: TextNode,
                            innerTag: string,
                            format: number,
                            text: string,
                          Severity: Minor
                          Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                      if (prevFormat & flag) {
                                        domClassList.remove(...classNames);
                                      }
                            Severity: Major
                            Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 45 mins to fix

                              Function mergeWithSibling has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                mergeWithSibling(target: TextNode): TextNode {
                                  const isBefore = target === this.getPreviousSibling();
                                  if (!isBefore && target !== this.getNextSibling()) {
                                    invariant(
                                      false,
                              Severity: Minor
                              Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 45 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

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

                                tag: string,
                                prevFormat: number,
                                nextFormat: number,
                                dom: HTMLElement,
                                textClassNames: TextNodeThemeClasses,
                              Severity: Minor
                              Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 35 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                  return null;
                                Severity: Major
                                Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 30 mins to fix

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

                                          if (
                                            focus.key === key &&
                                            focus.type === 'text' &&
                                            focus.offset > textSize &&
                                            focus.offset <= nextTextSize
                                  Severity: Major
                                  Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts and 1 other location - About 2 hrs to fix
                                  resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts on lines 1008..1017

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

                                  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 (
                                            anchor.key === key &&
                                            anchor.type === 'text' &&
                                            anchor.offset > textSize &&
                                            anchor.offset <= nextTextSize
                                  Severity: Major
                                  Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts and 1 other location - About 2 hrs to fix
                                  resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts on lines 1018..1027

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

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                    static importJSON(serializedNode: SerializedTextNode): TextNode {
                                      const node = $createTextNode(serializedNode.text);
                                      node.setFormat(serializedNode.format);
                                      node.setDetail(serializedNode.detail);
                                      node.setMode(serializedNode.mode);
                                  Severity: Major
                                  Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts and 1 other location - About 2 hrs to fix
                                  resources/js/wysiwyg/lexical/core/__tests__/utils/index.ts on lines 286..295

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

                                  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

                                    setFormat(format: TextFormatType | number): this {
                                      const self = this.getWritable();
                                      self.__format =
                                        typeof format === 'string' ? TEXT_TYPE_TO_FORMAT[format] : format;
                                      return self;
                                  Severity: Major
                                  Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts and 1 other location - About 1 hr to fix
                                  resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts on lines 718..723

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

                                  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

                                    setDetail(detail: TextDetailType | number): this {
                                      const self = this.getWritable();
                                      self.__detail =
                                        typeof detail === 'string' ? DETAIL_TYPE_TO_DETAIL[detail] : detail;
                                      return self;
                                  Severity: Major
                                  Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts and 1 other location - About 1 hr to fix
                                  resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts on lines 700..705

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

                                  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

                                    while (
                                      right + left < aLength &&
                                      right + left < bLength &&
                                      a[aLength - right - 1] === b[bLength - right - 1]
                                    ) {
                                  Severity: Minor
                                  Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts and 1 other location - About 55 mins to fix
                                  resources/js/wysiwyg/lexical/core/shared/simpleDiffWithCursor.ts on lines 29..35

                                  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

                                    isUnmergeable(): boolean {
                                      const self = this.getLatest();
                                      return (self.__detail & IS_UNMERGEABLE) !== 0;
                                    }
                                  Severity: Minor
                                  Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts and 1 other location - About 30 mins to fix
                                  resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts on lines 401..404

                                  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

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

                                    isDirectionless(): boolean {
                                      const self = this.getLatest();
                                      return (self.__detail & IS_DIRECTIONLESS) !== 0;
                                    }
                                  Severity: Minor
                                  Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts and 1 other location - About 30 mins to fix
                                  resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts on lines 411..414

                                  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

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

                                        if (focus !== null && focus.key === targetKey) {
                                          adjustPointOffsetForMergedSibling(
                                            focus,
                                            isBefore,
                                            key,
                                  Severity: Minor
                                  Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts and 1 other location - About 30 mins to fix
                                  resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts on lines 1089..1098

                                  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

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

                                        if (anchor !== null && anchor.key === targetKey) {
                                          adjustPointOffsetForMergedSibling(
                                            anchor,
                                            isBefore,
                                            key,
                                  Severity: Minor
                                  Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts and 1 other location - About 30 mins to fix
                                  resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts on lines 1099..1108

                                  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