BookStackApp/BookStack

View on GitHub

Showing 1,485 of 1,485 total issues

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

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

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

      describe('getFirstChild()', () => {
        test('basic', async () => {
          await update(() => {
            expect(
              $getRoot()
    resources/js/wysiwyg/lexical/core/nodes/__tests__/unit/LexicalElementNode.test.ts on lines 175..193

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

    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

      describe('getLastChild()', () => {
        test('basic', async () => {
          await update(() => {
            expect(
              $getRoot()
    resources/js/wysiwyg/lexical/core/nodes/__tests__/unit/LexicalElementNode.test.ts on lines 155..173

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

    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

    File index.ts has 401 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: Minor
    Found in resources/js/wysiwyg/lexical/utils/index.ts - About 5 hrs to fix

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

          test('isLastItemInList should return true if the listItem is not the last in a non-nested list.', async () => {
            const editor = testEnv.editor;
      
            await editor.update(() => {
              // Root
      resources/js/wysiwyg/lexical/list/__tests__/unit/utils.test.ts on lines 248..272

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

      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('isLastItemInList should return true if the listItem is the last in a non-nested list.', async () => {
            const editor = testEnv.editor;
      
            await editor.update(() => {
              // Root
      resources/js/wysiwyg/lexical/list/__tests__/unit/utils.test.ts on lines 309..333

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

      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

          public function move(Request $request, string $bookSlug, string $pageSlug)
          {
              $page = $this->queries->findVisibleBySlugsOrFail($bookSlug, $pageSlug);
              $this->checkOwnablePermission('page-update', $page);
              $this->checkOwnablePermission('page-delete', $page);
      Severity: Major
      Found in app/Entities/Controllers/PageController.php and 1 other location - About 5 hrs to fix
      app/Entities/Controllers/ChapterController.php on lines 191..213

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 195.

      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

          public function move(Request $request, string $bookSlug, string $chapterSlug)
          {
              $chapter = $this->queries->findVisibleBySlugsOrFail($bookSlug, $chapterSlug);
              $this->checkOwnablePermission('chapter-update', $chapter);
              $this->checkOwnablePermission('chapter-delete', $chapter);
      Severity: Major
      Found in app/Entities/Controllers/ChapterController.php and 1 other location - About 5 hrs to fix
      app/Entities/Controllers/PageController.php on lines 401..423

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

      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

      Function $wrapNodesImpl has 139 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function $wrapNodesImpl(
        selection: BaseSelection,
        nodes: LexicalNode[],
        nodesLength: number,
        createElement: () => ElementNode,
      Severity: Major
      Found in resources/js/wysiwyg/lexical/selection/range-selection.ts - About 5 hrs to fix

        File LexicalAutoLinkNode.test.ts has 396 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.

          File index.ts has 395 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: Minor
          Found in resources/js/wysiwyg/lexical/history/index.ts - About 5 hrs to fix

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

              test('clearing subscript does not set superscript', async () => {
                await update(() => {
                  const paragraphNode = $createParagraphNode();
                  const textNode = $createTextNode('Hello World');
                  paragraphNode.append(textNode);
            resources/js/wysiwyg/lexical/core/nodes/__tests__/unit/LexicalTextNode.test.ts on lines 253..264
            resources/js/wysiwyg/lexical/core/nodes/__tests__/unit/LexicalTextNode.test.ts on lines 266..277
            resources/js/wysiwyg/lexical/core/nodes/__tests__/unit/LexicalTextNode.test.ts on lines 292..303

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

            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

              test('setting subscript clears superscript', async () => {
                await update(() => {
                  const paragraphNode = $createParagraphNode();
                  const textNode = $createTextNode('Hello World');
                  paragraphNode.append(textNode);
            resources/js/wysiwyg/lexical/core/nodes/__tests__/unit/LexicalTextNode.test.ts on lines 266..277
            resources/js/wysiwyg/lexical/core/nodes/__tests__/unit/LexicalTextNode.test.ts on lines 279..290
            resources/js/wysiwyg/lexical/core/nodes/__tests__/unit/LexicalTextNode.test.ts on lines 292..303

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

            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

              test('setting superscript clears subscript', async () => {
                await update(() => {
                  const paragraphNode = $createParagraphNode();
                  const textNode = $createTextNode('Hello World');
                  paragraphNode.append(textNode);
            resources/js/wysiwyg/lexical/core/nodes/__tests__/unit/LexicalTextNode.test.ts on lines 253..264
            resources/js/wysiwyg/lexical/core/nodes/__tests__/unit/LexicalTextNode.test.ts on lines 279..290
            resources/js/wysiwyg/lexical/core/nodes/__tests__/unit/LexicalTextNode.test.ts on lines 292..303

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

            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

              test('clearing superscript does not set subscript', async () => {
                await update(() => {
                  const paragraphNode = $createParagraphNode();
                  const textNode = $createTextNode('Hello World');
                  paragraphNode.append(textNode);
            resources/js/wysiwyg/lexical/core/nodes/__tests__/unit/LexicalTextNode.test.ts on lines 253..264
            resources/js/wysiwyg/lexical/core/nodes/__tests__/unit/LexicalTextNode.test.ts on lines 266..277
            resources/js/wysiwyg/lexical/core/nodes/__tests__/unit/LexicalTextNode.test.ts on lines 279..290

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

            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

            Severity
            Category
            Status
            Source
            Language