BookStackApp/BookStack

View on GitHub
resources/js/wysiwyg/lexical/rich-text/index.ts

Summary

Maintainability
F
1 wk
Test Coverage

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

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

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

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

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

        static importDOM(): DOMConversionMap | null {
          return {
            h1: (node: Node) => ({
              conversion: $convertHeadingElement,
              priority: 0,
      Severity: Minor
      Found in resources/js/wysiwyg/lexical/rich-text/index.ts - About 2 hrs to fix

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

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

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

          function $handleIndentAndOutdent(
            indentOrOutdent: (block: ElementNode) => void,
          ): boolean {
            const selection = $getSelection();
            if (!$isRangeSelection(selection)) {
          Severity: Minor
          Found in resources/js/wysiwyg/lexical/rich-text/index.ts - About 55 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

          Consider simplifying this complex logical expression.
          Open

            if (
              nodeName === 'h1' ||
              nodeName === 'h2' ||
              nodeName === 'h3' ||
              nodeName === 'h4' ||
          Severity: Major
          Found in resources/js/wysiwyg/lexical/rich-text/index.ts - About 40 mins to fix

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

              insertNewAfter(
                selection?: RangeSelection,
                restoreSelection = true,
              ): ParagraphNode | HeadingNode {
                const anchorOffet = selection ? selection.anchor.offset : 0;
            Severity: Minor
            Found in resources/js/wysiwyg/lexical/rich-text/index.ts - About 35 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

              exportDOM(editor: LexicalEditor): DOMExportOutput {
                const {element} = super.exportDOM(editor);
            
                if (element && isHTMLElement(element)) {
                  if (this.isEmpty()) {
            Severity: Major
            Found in resources/js/wysiwyg/lexical/rich-text/index.ts and 1 other location - About 4 hrs to fix
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 311..326

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

            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

              exportDOM(editor: LexicalEditor): DOMExportOutput {
                const {element} = super.exportDOM(editor);
            
                if (element && isHTMLElement(element)) {
                  if (this.isEmpty()) {
            Severity: Major
            Found in resources/js/wysiwyg/lexical/rich-text/index.ts and 1 other location - About 4 hrs to fix
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 151..166

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

            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 (
                        !event.shiftKey &&
                        $isDecoratorNode(possibleNode) &&
                        !possibleNode.isIsolated() &&
                        !possibleNode.isInline()
            Severity: Major
            Found in resources/js/wysiwyg/lexical/rich-text/index.ts and 1 other location - About 1 hr to fix
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 733..742

            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

                      if (
                        !event.shiftKey &&
                        $isDecoratorNode(possibleNode) &&
                        !possibleNode.isIsolated() &&
                        !possibleNode.isInline()
            Severity: Major
            Found in resources/js/wysiwyg/lexical/rich-text/index.ts and 1 other location - About 1 hr to fix
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 766..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 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

              static importJSON(serializedNode: SerializedHeadingNode): HeadingNode {
                const node = $createHeadingNode(serializedNode.tag);
                node.setFormat(serializedNode.format);
                node.setIndent(serializedNode.indent);
                return node;
            Severity: Major
            Found in resources/js/wysiwyg/lexical/rich-text/index.ts and 1 other location - About 1 hr to fix
            resources/js/wysiwyg/nodes/custom-list.ts on lines 67..72

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

            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

              static importJSON(serializedNode: SerializedQuoteNode): QuoteNode {
                const node = $createQuoteNode();
                node.setFormat(serializedNode.format);
                node.setIndent(serializedNode.indent);
                return node;
            Severity: Major
            Found in resources/js/wysiwyg/lexical/rich-text/index.ts and 2 other locations - About 1 hr to fix
            resources/js/wysiwyg/lexical/core/nodes/LexicalTabNode.ts on lines 50..55
            resources/js/wysiwyg/nodes/details.ts on lines 91..96

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

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

                editor.registerCommand<boolean>(
                  DELETE_CHARACTER_COMMAND,
                  (isBackward) => {
                    const selection = $getSelection();
                    if (!$isRangeSelection(selection)) {
            Severity: Major
            Found in resources/js/wysiwyg/lexical/rich-text/index.ts and 3 other locations - About 1 hr to fix
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 563..574
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 575..586
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 662..673

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

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

                editor.registerCommand<boolean>(
                  DELETE_WORD_COMMAND,
                  (isBackward) => {
                    const selection = $getSelection();
                    if (!$isRangeSelection(selection)) {
            Severity: Major
            Found in resources/js/wysiwyg/lexical/rich-text/index.ts and 3 other locations - About 1 hr to fix
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 551..562
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 575..586
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 662..673

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

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

                editor.registerCommand<boolean>(
                  DELETE_LINE_COMMAND,
                  (isBackward) => {
                    const selection = $getSelection();
                    if (!$isRangeSelection(selection)) {
            Severity: Major
            Found in resources/js/wysiwyg/lexical/rich-text/index.ts and 3 other locations - About 1 hr to fix
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 551..562
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 563..574
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 662..673

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

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

                editor.registerCommand<boolean>(
                  INSERT_LINE_BREAK_COMMAND,
                  (selectStart) => {
                    const selection = $getSelection();
                    if (!$isRangeSelection(selection)) {
            Severity: Major
            Found in resources/js/wysiwyg/lexical/rich-text/index.ts and 3 other locations - About 1 hr to fix
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 551..562
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 563..574
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 575..586

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

            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 (anchorOffet === 0 && !this.isEmpty() && selection) {
                  const paragraph = $createParagraphNode();
                  paragraph.select();
                  this.replace(paragraph, true);
                }
            Severity: Major
            Found in resources/js/wysiwyg/lexical/rich-text/index.ts and 1 other location - About 1 hr to fix
            resources/js/wysiwyg/nodes/callout.ts on lines 108..112

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

            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

                editor.registerCommand(
                  REMOVE_TEXT_COMMAND,
                  () => {
                    const selection = $getSelection();
                    if (!$isRangeSelection(selection)) {
            Severity: Major
            Found in resources/js/wysiwyg/lexical/rich-text/index.ts and 2 other locations - About 1 hr to fix
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 674..685
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 911..922

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

            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

                editor.registerCommand(
                  KEY_ESCAPE_COMMAND,
                  () => {
                    const selection = $getSelection();
                    if (!$isRangeSelection(selection)) {
            Severity: Major
            Found in resources/js/wysiwyg/lexical/rich-text/index.ts and 2 other locations - About 1 hr to fix
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 616..627
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 674..685

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

            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

                editor.registerCommand(
                  INSERT_PARAGRAPH_COMMAND,
                  () => {
                    const selection = $getSelection();
                    if (!$isRangeSelection(selection)) {
            Severity: Major
            Found in resources/js/wysiwyg/lexical/rich-text/index.ts and 2 other locations - About 1 hr to fix
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 616..627
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 911..922

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

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

              static importDOM(): DOMConversionMap | null {
                return {
                  blockquote: (node: Node) => ({
                    conversion: $convertBlockquoteElement,
                    priority: 0,
            Severity: Major
            Found in resources/js/wysiwyg/lexical/rich-text/index.ts and 6 other locations - About 35 mins to fix
            resources/js/wysiwyg/lexical/core/nodes/LexicalParagraphNode.ts on lines 118..125
            resources/js/wysiwyg/lexical/link/index.ts on lines 148..155
            resources/js/wysiwyg/lexical/table/LexicalTableNode.ts on lines 45..52
            resources/js/wysiwyg/lexical/table/LexicalTableRowNode.ts on lines 45..52
            resources/js/wysiwyg/nodes/custom-quote.ts on lines 93..100
            resources/js/wysiwyg/nodes/custom-table-row.ts on lines 63..70

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

            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 (
                nodeName === 'h1' ||
                nodeName === 'h2' ||
                nodeName === 'h3' ||
                nodeName === 'h4' ||
            Severity: Minor
            Found in resources/js/wysiwyg/lexical/rich-text/index.ts and 1 other location - About 35 mins to fix
            resources/js/wysiwyg/nodes/custom-heading.ts on lines 126..136

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 46.

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

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

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

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

            Refactorings

            Further Reading

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

                      const element = $findMatchingParent(
                        node,
                        (parentNode): parentNode is ElementNode =>
                          $isElementNode(parentNode) && !parentNode.isInline(),
                      );
            Severity: Minor
            Found in resources/js/wysiwyg/lexical/rich-text/index.ts and 1 other location - About 30 mins to fix
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 510..514

            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

                const parentBlock = $findMatchingParent(
                  node,
                  (parentNode): parentNode is ElementNode =>
                    $isElementNode(parentNode) && !parentNode.isInline(),
                );
            Severity: Minor
            Found in resources/js/wysiwyg/lexical/rich-text/index.ts and 1 other location - About 30 mins to fix
            resources/js/wysiwyg/lexical/rich-text/index.ts on lines 649..653

            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