BookStackApp/BookStack

View on GitHub
resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts

Summary

Maintainability
F
1 mo
Test Coverage

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

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

    Function setupTestCase has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          const setupTestCase = (
            cb: (selection: RangeSelection, el: ElementNode) => void,
          ) => {
            const editor = createTestEditor();
    
    

      Function setupTestCase has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            const setupTestCase = (
              cb: (selection: RangeSelection, el: ElementNode) => void,
            ) => {
              const editor = createTestEditor();
      
      

        Function setupTestCase has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              const setupTestCase = (
                cb: (selection: RangeSelection, el: ElementNode) => void,
              ) => {
                const editor = createTestEditor();
        
        

          Function setupTestCase has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                const setupTestCase = (
                  cb: (selection: RangeSelection, el: ElementNode) => void,
                ) => {
                  const editor = createTestEditor();
          
          

            Function setupTestCase has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  const setupTestCase = (
                    cb: (selection: RangeSelection, el: ElementNode) => void,
                  ) => {
                    const editor = createTestEditor();
            
            

              Function setupTestCase has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    const setupTestCase = (
                      cb: (selection: RangeSelection, node: ElementNode) => void,
                    ) => {
                      const editor = createTestEditor();
              
              

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

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

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 370.

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

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

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

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

                Refactorings

                Further Reading

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

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

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 370.

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

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

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

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

                Refactorings

                Further Reading

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

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

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 367.

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

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

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

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

                Refactorings

                Further Reading

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

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

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 367.

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

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

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

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

                Refactorings

                Further Reading

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

                      const setupTestCase = (
                        cb: (selection: RangeSelection, el: ElementNode) => void,
                      ) => {
                        const editor = createTestEditor();
                
                
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 993..1035

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

                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 setupTestCase = (
                        cb: (selection: RangeSelection, el: ElementNode) => void,
                      ) => {
                        const editor = createTestEditor();
                
                
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 840..882

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

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

                      setupTestCase((selection, element) => {
                        selection.formatText('bold');
                        selection.insertText('Test');
                        const firstChild = element.getFirstChild()!;
                
                
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 809..831
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 961..984
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1115..1137
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1758..1780

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

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

                      setupTestCase((selection, element) => {
                        selection.formatText('bold');
                        selection.insertText('Test');
                
                        const firstChild = element.getFirstChild()!;
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 809..831
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1115..1137
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1591..1613
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1758..1780

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

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

                      setupTestCase((selection, element) => {
                        selection.formatText('bold');
                        selection.insertText('Test');
                        const firstChild = element.getFirstChild()!;
                
                
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 809..831
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 961..984
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1115..1137
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1591..1613

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

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

                      setupTestCase((selection, element) => {
                        selection.formatText('bold');
                        selection.insertText('Test');
                        const firstChild = element.getFirstChild()!;
                
                
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 961..984
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1115..1137
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1591..1613
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1758..1780

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

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

                      setupTestCase((selection, element) => {
                        selection.formatText('bold');
                        selection.insertText('Test');
                        const lastChild = element.getLastChild()!;
                
                
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 809..831
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 961..984
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1591..1613
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1758..1780

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

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

                      setupTestCase((selection, element) => {
                        selection.insertText('Test');
                        const firstChild = element.getFirstChild()!;
                
                        expect(firstChild.getTextContent()).toBe('Test');
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 895..916
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1048..1069
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1525..1546
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1691..1712

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

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

                      setupTestCase((selection, element) => {
                        selection.insertText('Test');
                        const firstChild = element.getFirstChild()!;
                
                        expect(firstChild.getTextContent()).toBe('Test');
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 742..763
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 895..916
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1048..1069
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1525..1546

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

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

                      setupTestCase((selection, element) => {
                        selection.insertText('Test');
                        const firstChild = element.getFirstChild()!;
                
                        expect(firstChild.getTextContent()).toBe('Test');
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 742..763
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 895..916
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1048..1069
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1691..1712

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

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

                      setupTestCase((selection, element) => {
                        selection.insertText('Test');
                        const firstChild = element.getFirstChild()!;
                
                        expect(firstChild.getTextContent()).toBe('Test');
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 742..763
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1048..1069
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1525..1546
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1691..1712

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

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

                      setupTestCase((selection, element) => {
                        selection.insertText('Test');
                        const lastChild = element.getLastChild()!;
                
                        expect(lastChild.getTextContent()).toBe('Test');
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 742..763
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 895..916
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1525..1546
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1691..1712

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

                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

                      setupTestCase((selection, element) => {
                        selection.insertNodes([$createTextNode('foo')]);
                
                        expect(selection.anchor).toEqual(
                          expect.objectContaining({
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1374..1392

                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

                      setupTestCase((selection, element) => {
                        selection.insertNodes([$createTextNode('foo')]);
                
                        expect(selection.anchor).toEqual(
                          expect.objectContaining({
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 170..188

                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

                      setupTestCase((selection, element) => {
                        selection.insertParagraph();
                        const nextElement = element.getNextSibling()!;
                
                        expect(selection.anchor).toEqual(
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1072..1091
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1715..1734

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

                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

                      setupTestCase((selection, element) => {
                        selection.insertParagraph();
                        const nextSibling = element.getNextSibling()!;
                
                        expect(selection.anchor).toEqual(
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 766..785
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1715..1734

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

                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

                      setupTestCase((selection, element) => {
                        selection.insertParagraph();
                        const nextElement = element.getNextSibling()!;
                
                        expect(selection.anchor).toEqual(
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 766..785
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1072..1091

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

                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

                      setupTestCase((selection, state) => {
                        selection.insertText('Test');
                
                        expect($getNodeByKey('a')!.getTextContent()).toBe('Testa');
                
                
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1351..1371

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

                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

                      setupTestCase((selection, state) => {
                        selection.insertText('Test');
                
                        expect($getNodeByKey('a')!.getTextContent()).toBe('Test');
                
                
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 147..167

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

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

                      setupTestCase((selection, element) => {
                        selection.insertLineBreak(true);
                
                        expect(selection.anchor).toEqual(
                          expect.objectContaining({
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 212..230
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 788..806
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 940..958
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1416..1434
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1570..1588

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

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

                      setupTestCase((selection, element) => {
                        selection.insertLineBreak(true);
                
                        expect(selection.anchor).toEqual(
                          expect.objectContaining({
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 212..230
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 940..958
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1416..1434
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1570..1588
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1737..1755

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

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

                      setupTestCase((selection, element) => {
                        selection.insertLineBreak(true);
                
                        expect(selection.anchor).toEqual(
                          expect.objectContaining({
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 212..230
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 788..806
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 940..958
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1570..1588
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1737..1755

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

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

                      setupTestCase((selection, element) => {
                        selection.insertLineBreak(true);
                
                        expect(selection.anchor).toEqual(
                          expect.objectContaining({
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 212..230
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 788..806
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 940..958
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1416..1434
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1737..1755

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

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

                      setupTestCase((selection, element) => {
                        selection.insertLineBreak(true);
                
                        expect(selection.anchor).toEqual(
                          expect.objectContaining({
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 788..806
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 940..958
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1416..1434
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1570..1588
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1737..1755

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

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

                      setupTestCase((selection, element) => {
                        selection.insertLineBreak(true);
                
                        expect(selection.anchor).toEqual(
                          expect.objectContaining({
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 212..230
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 788..806
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1416..1434
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1570..1588
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1737..1755

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

                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

                      setupTestCase((selection, element) => {
                        selection.insertParagraph();
                
                        expect(selection.anchor).toEqual(
                          expect.objectContaining({
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1549..1567

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

                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

                      setupTestCase((selection, element) => {
                        selection.insertParagraph();
                
                        expect(selection.anchor).toEqual(
                          expect.objectContaining({
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 919..937

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

                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

                      setupTestCase((selection) => {
                        selection.insertParagraph();
                
                        expect(selection.anchor).toEqual(
                          expect.objectContaining({
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1395..1413

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

                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

                      setupTestCase((selection) => {
                        selection.insertParagraph();
                
                        expect(selection.anchor).toEqual(
                          expect.objectContaining({
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 191..209

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

                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

                Range.prototype.getBoundingClientRect = function (): DOMRect {
                  const rect = {
                    bottom: 0,
                    height: 0,
                    left: 0,
                resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalEventHelpers.test.ts on lines 24..41
                resources/js/wysiwyg/lexical/utils/__tests__/unit/LexicalEventHelpers.test.ts on lines 45..62

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

                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

                          expect(selection.anchor).toEqual(
                            expect.objectContaining({
                              key: paragraph
                                .getChildAtIndex(paragraph.getChildrenSize() - 2)!
                                .getKey(),
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 2153..2161

                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

                          expect(selection.focus).toEqual(
                            expect.objectContaining({
                              key: paragraph
                                .getChildAtIndex(paragraph.getChildrenSize() - 2)!
                                .getKey(),
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 2143..2151

                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

                      setupTestCase((selection, state) => {
                        expect(selection.getNodes()).toEqual([
                          $getNodeByKey('a'),
                          $getNodeByKey('b'),
                          $getNodeByKey('c'),
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1783..1789

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

                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

                      setupTestCase((selection, element) => {
                        expect(selection.extract()).toEqual([
                          $getNodeByKey('a'),
                          $getNodeByKey('b'),
                          $getNodeByKey('c'),
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1677..1683

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

                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

                      setupTestCase((selection, state) => {
                        expect(selection.getNodes()).toEqual([$getNodeByKey('c')]);
                      });
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 137..139
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 885..887

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

                      setupTestCase((selection, state) => {
                        expect(selection.getNodes()).toEqual([$getNodeByKey('a')]);
                      });
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 885..887
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1038..1040

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

                      setupTestCase((selection, state) => {
                        expect(selection.getNodes()).toEqual([$getNodeByKey('a')]);
                      });
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 137..139
                resources/js/wysiwyg/lexical/selection/__tests__/unit/LexicalSelectionHelpers.test.ts on lines 1038..1040

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 46.

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

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

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

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

                Refactorings

                Further Reading

                There are no issues that match your filters.

                Category
                Status