BookStackApp/BookStack

View on GitHub

Showing 1,485 of 1,485 total issues

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

    book_end: {
        active(elem, parent) {
            return parent || (parent === null && elem.nextElementSibling);
        },
        run(elem, parent, book) {
Severity: Major
Found in resources/js/components/book-sort.js and 1 other location - About 1 hr to fix
resources/js/components/book-sort.js on lines 121..128

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

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

export function $getTableRowNodeFromTableCellNodeOrThrow(
  startingNode: LexicalNode,
): TableRowNode {
  const node = $findMatchingParent(startingNode, (n) => $isTableRowNode(n));

Severity: Major
Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts and 1 other location - About 1 hr to fix
resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts on lines 105..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 65.

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

    exportJSON(): SerializedCustomParagraphNode {
        return {
            ...super.exportJSON(),
            type: 'custom-paragraph',
            version: 1,
Severity: Major
Found in resources/js/wysiwyg/nodes/custom-paragraph.ts and 2 other locations - About 1 hr to fix
resources/js/wysiwyg/nodes/custom-heading.ts on lines 76..85
resources/js/wysiwyg/nodes/custom-quote.ts on lines 76..85

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

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

    exportJSON(): SerializedCustomHeadingNode {
        return {
            ...super.exportJSON(),
            type: 'custom-heading',
            version: 1,
Severity: Major
Found in resources/js/wysiwyg/nodes/custom-heading.ts and 2 other locations - About 1 hr to fix
resources/js/wysiwyg/nodes/custom-paragraph.ts on lines 76..85
resources/js/wysiwyg/nodes/custom-quote.ts on lines 76..85

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

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

        if (prevNode.__alt !== this.__alt) {
            if (this.__alt) {
                dom.setAttribute('alt', String(this.__alt));
            } else {
                dom.removeAttribute('alt');
Severity: Major
Found in resources/js/wysiwyg/nodes/image.ts and 2 other locations - About 1 hr to fix
resources/js/wysiwyg/nodes/image.ts on lines 148..154
resources/js/wysiwyg/nodes/image.ts on lines 156..162

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

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

export function $getTableNodeFromLexicalNodeOrThrow(
  startingNode: LexicalNode,
): TableNode {
  const node = $findMatchingParent(startingNode, (n) => $isTableNode(n));

Severity: Major
Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts and 1 other location - About 1 hr to fix
resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts on lines 93..103

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

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

        if (prevNode.__height !== this.__height) {
            if (this.__height) {
                dom.setAttribute('height', String(this.__height));
            } else {
                dom.removeAttribute('height');
Severity: Major
Found in resources/js/wysiwyg/nodes/image.ts and 2 other locations - About 1 hr to fix
resources/js/wysiwyg/nodes/image.ts on lines 148..154
resources/js/wysiwyg/nodes/image.ts on lines 164..170

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

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

    exportJSON(): SerializedCustomQuoteNode {
        return {
            ...super.exportJSON(),
            type: 'custom-quote',
            version: 1,
Severity: Major
Found in resources/js/wysiwyg/nodes/custom-quote.ts and 2 other locations - About 1 hr to fix
resources/js/wysiwyg/nodes/custom-heading.ts on lines 76..85
resources/js/wysiwyg/nodes/custom-paragraph.ts on lines 76..85

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

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

        if (prevNode.__width !== this.__width) {
            if (this.__width) {
                dom.setAttribute('width', String(this.__width));
            } else {
                dom.removeAttribute('width');
Severity: Major
Found in resources/js/wysiwyg/nodes/image.ts and 2 other locations - About 1 hr to fix
resources/js/wysiwyg/nodes/image.ts on lines 156..162
resources/js/wysiwyg/nodes/image.ts on lines 164..170

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

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

function handleMediaInsert(data: DataTransfer, context: EditorUiContext): boolean {
    const clipboard = new Clipboard(data);
    let handled = false;

    // Don't handle the event ourselves if no items exist of contains table-looking data
Severity: Minor
Found in resources/js/wysiwyg/services/drop-paste-handling.ts - About 1 hr to fix

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

          _syncChildFromLexical(
            binding: Binding,
            index: number,
            key: NodeKey,
            prevNodeMap: null | NodeMap,
        Severity: Minor
        Found in resources/js/wysiwyg/lexical/yjs/CollabElementNode.ts - About 1 hr to fix

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

            export function $sliceSelectedTextNodeContent(
              selection: BaseSelection,
              textNode: TextNode,
            ): LexicalNode {
              const anchorAndFocus = selection.getStartEndPoints();
            Severity: Minor
            Found in resources/js/wysiwyg/lexical/selection/lexical-node.ts - About 1 hr to fix

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

                replace<N extends LexicalNode>(
                  replaceWithNode: N,
                  includeChildren?: boolean,
                ): N {
                  if ($isListItemNode(replaceWithNode)) {
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/list/LexicalListItemNode.ts - About 1 hr to fix

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

                      const setup = async (
                        mode: 'start-of-paragraph' | 'mid-paragraph' | 'end-of-paragraph',
                      ) => {
                        const {container, editor} = testEnv;
                
                

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

                      const mergeAction = (() => {
                        const isSameEditor =
                          currentHistoryEntry === null || currentHistoryEntry.editor === editor;
                        const shouldPushHistory = tags.has('history-push');
                        const shouldMergeHistory =
                  Severity: Minor
                  Found in resources/js/wysiwyg/lexical/history/index.ts - About 1 hr to fix

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

                    export function $normalizeTextNode(textNode: TextNode): void {
                      let node = textNode;
                    
                      if (node.__text === '' && node.isSimpleText() && !node.isUnmergeable()) {
                        node.remove();
                    Severity: Minor
                    Found in resources/js/wysiwyg/lexical/core/LexicalNormalization.ts - About 1 hr to fix

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

                      function reconcileElementTerminatingLineBreak(
                        prevElement: null | ElementNode,
                        nextElement: ElementNode,
                        dom: HTMLElement,
                      ): void {
                      Severity: Minor
                      Found in resources/js/wysiwyg/lexical/core/LexicalReconciler.ts - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language