BookStackApp/BookStack

View on GitHub

Showing 1,485 of 1,485 total issues

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

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

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

        protected function filterUpdatedBy(EloquentBuilder $query, Entity $model, string $input, bool $negated)
        {
            $userSlug = $input === 'me' ? user()->slug : trim($input);
            $user = User::query()->where('slug', '=', $userSlug)->first(['id']);
            if ($user) {
    Severity: Major
    Found in app/Search/SearchRunner.php and 2 other locations - About 1 hr to fix
    app/Search/SearchRunner.php on lines 377..384
    app/Search/SearchRunner.php on lines 395..402

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

    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

        protected function filterCreatedBy(EloquentBuilder $query, Entity $model, string $input, bool $negated)
        {
            $userSlug = $input === 'me' ? user()->slug : trim($input);
            $user = User::query()->where('slug', '=', $userSlug)->first(['id']);
            if ($user) {
    Severity: Major
    Found in app/Search/SearchRunner.php and 2 other locations - About 1 hr to fix
    app/Search/SearchRunner.php on lines 386..393
    app/Search/SearchRunner.php on lines 395..402

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

    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

        protected function filterOwnedBy(EloquentBuilder $query, Entity $model, string $input, bool $negated)
        {
            $userSlug = $input === 'me' ? user()->slug : trim($input);
            $user = User::query()->where('slug', '=', $userSlug)->first(['id']);
            if ($user) {
    Severity: Major
    Found in app/Search/SearchRunner.php and 2 other locations - About 1 hr to fix
    app/Search/SearchRunner.php on lines 377..384
    app/Search/SearchRunner.php on lines 386..393

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

    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 show has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        show(event = null) {
            this.hideAll();
    
            this.menu.style.display = 'block';
            this.menu.classList.add('anim', 'menuIn');
    Severity: Minor
    Found in resources/js/components/dropdown.js - About 1 hr to fix

      Function getPositionFromElementAndOffset has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function getPositionFromElementAndOffset(
        node: CollabElementNode,
        offset: number,
        boundaryIsEdge: boolean,
      ): {
      Severity: Minor
      Found in resources/js/wysiwyg/lexical/yjs/Utils.ts - About 1 hr to fix

        Function $insertTableRow has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function $insertTableRow(
          tableNode: TableNode,
          targetIndex: number,
          shouldInsertAfter = true,
          rowCount: number,
        Severity: Minor
        Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 1 hr to fix

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

                  await editor.update(() => {
                    const rootNode = $getRoot();
                    paragraphNode = new ParagraphNode();
                    textNode = new TextNode('foo');
                    paragraphNode.append(textNode);
          resources/js/wysiwyg/lexical/core/__tests__/unit/LexicalUtils.test.ts on lines 193..199

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 71.

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

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

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

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

          Refactorings

          Further Reading

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

                  await editor.update(() => {
                    const rootNode = $getRoot();
                    const barParagraphNode = new ParagraphNode();
                    barTextNode = new TextNode('bar');
                    barParagraphNode.append(barTextNode);
          resources/js/wysiwyg/lexical/core/__tests__/unit/LexicalNode.test.ts on lines 1391..1397

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 71.

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

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

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

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

          Refactorings

          Further Reading

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

                  await editor.update(() => {
                    const rootNode = $getRoot();
                    const barParagraphNode = new ParagraphNode();
                    barTextNode = new TextNode('bar');
                    barParagraphNode.append(barTextNode);
          resources/js/wysiwyg/lexical/core/__tests__/unit/LexicalNode.test.ts on lines 1096..1102

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 71.

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

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

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

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

          Refactorings

          Further Reading

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

                await editor.update(() => {
                  const rootNode = $getRoot();
                  paragraphNode = new ParagraphNode();
                  textNode = new TextNode('foo');
                  paragraphNode.append(textNode);
          resources/js/wysiwyg/lexical/core/__tests__/unit/LexicalNode.test.ts on lines 109..115

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

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

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 71.

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

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

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

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

          Refactorings

          Further Reading

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

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

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 71.

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

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

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

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

          Refactorings

          Further Reading

          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

          Function setup has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              setup(context: EditorUiContext, element: HTMLElement) {
                  const codeNode = this.getNode() as CodeBlockNode;
                  const preEl = element.querySelector('pre');
                  if (!preEl) {
                      return;
          Severity: Minor
          Found in resources/js/wysiwyg/ui/decorators/code-block.ts - About 1 hr to fix

            Function buildCellMap has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected buildCellMap(table: CustomTableNode) {
                    const rowsAndCells: CustomTableCellNode[][] = [];
                    const setCell = (x: number, y: number, cell: CustomTableCellNode) => {
                        if (typeof rowsAndCells[y] === 'undefined') {
                            rowsAndCells[y] = [];
            Severity: Minor
            Found in resources/js/wysiwyg/utils/table-map.ts - About 1 hr to fix

              Function syncYjsChangesToLexical has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function syncYjsChangesToLexical(
                binding: Binding,
                provider: Provider,
                events: Array<YEvent<YText>>,
                isFromUndoManger: boolean,
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/yjs/SyncEditorStates.ts - About 1 hr to fix

                Function $insertNodeToNearestRoot has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function $insertNodeToNearestRoot<T extends LexicalNode>(node: T): T {
                  const selection = $getSelection() || $getPreviousSelection();
                
                  if ($isRangeSelection(selection)) {
                    const {focus} = selection;
                Severity: Minor
                Found in resources/js/wysiwyg/lexical/utils/index.ts - About 1 hr to fix

                  Function $setListThemeClassNames has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function $setListThemeClassNames(
                    dom: HTMLElement,
                    editorThemeClasses: EditorThemeClasses,
                    node: ListNode,
                  ): void {
                  Severity: Minor
                  Found in resources/js/wysiwyg/lexical/list/LexicalListNode.ts - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language