BookStackApp/BookStack

View on GitHub

Showing 1,485 of 1,485 total issues

Function scrollIntoViewIfNeeded has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function scrollIntoViewIfNeeded(
  editor: LexicalEditor,
  selectionRect: DOMRect,
  rootElement: HTMLElement,
): void {
Severity: Minor
Found in resources/js/wysiwyg/lexical/core/LexicalUtils.ts - About 1 hr to fix

    Function updateContent has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    async function updateContent(pngData) {
        const loadingImage = window.baseUrl('/loading.gif');
    
        const handleUploadError = error => {
            if (error.status === 413) {
    Severity: Minor
    Found in resources/js/wysiwyg-tinymce/plugin-drawio.js - About 1 hr to fix

      Function syncPropertiesFromLexical has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function syncPropertiesFromLexical(
        binding: Binding,
        sharedType: XmlText | YMap<unknown> | XmlElement,
        prevLexicalNode: null | LexicalNode,
        nextLexicalNode: LexicalNode,
      Severity: Minor
      Found in resources/js/wysiwyg/lexical/yjs/Utils.ts - About 1 hr to fix

        Function splice has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          splice(
            binding: Binding,
            index: number,
            delCount: number,
            collabNode?:
        Severity: Minor
        Found in resources/js/wysiwyg/lexical/yjs/CollabElementNode.ts - About 1 hr to fix

          Function syncLexicalSelectionToYjs has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function syncLexicalSelectionToYjs(
            binding: Binding,
            provider: Provider,
            prevSelection: null | BaseSelection,
            nextSelection: null | BaseSelection,
          Severity: Minor
          Found in resources/js/wysiwyg/lexical/yjs/SyncCursors.ts - About 1 hr to fix

            Function $insertTableColumn has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Function parseEditorState has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function parseEditorState(
                serializedEditorState: SerializedEditorState,
                editor: LexicalEditor,
                updateFn: void | (() => void),
              ): EditorState {
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/core/LexicalUpdates.ts - About 1 hr to fix

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

                  getCellNodeFromCordsOrThrow(
                    x: number,
                    y: number,
                    table: TableDOMTable,
                  ): TableCellNode {
                Severity: Major
                Found in resources/js/wysiwyg/lexical/table/LexicalTableNode.ts and 1 other location - About 1 hr to fix
                resources/js/wysiwyg/lexical/table/LexicalTableNode.ts on lines 172..184

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

                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 isMoveToStart(
                  key: string,
                  ctrlKey: boolean,
                  shiftKey: boolean,
                  altKey: boolean,
                Severity: Major
                Found in resources/js/wysiwyg/lexical/core/LexicalUtils.ts and 1 other location - About 1 hr to fix
                resources/js/wysiwyg/lexical/core/LexicalUtils.ts on lines 997..1005

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

                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 isMoveToEnd(
                  key: string,
                  ctrlKey: boolean,
                  shiftKey: boolean,
                  altKey: boolean,
                Severity: Major
                Found in resources/js/wysiwyg/lexical/core/LexicalUtils.ts and 1 other location - About 1 hr to fix
                resources/js/wysiwyg/lexical/core/LexicalUtils.ts on lines 978..986

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

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

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

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

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

                Refactorings

                Further Reading

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

                    static clone(node: CustomParagraphNode): CustomParagraphNode {
                        const newNode = new CustomParagraphNode(node.__key);
                        newNode.__id = node.__id;
                        newNode.__alignment = node.__alignment;
                        newNode.__inset = node.__inset;
                Severity: Major
                Found in resources/js/wysiwyg/nodes/custom-paragraph.ts and 1 other location - About 1 hr to fix
                resources/js/wysiwyg/nodes/custom-quote.ts on lines 58..64

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

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

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

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

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

                Refactorings

                Further Reading

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

                    static clone(node: CustomQuoteNode) {
                        const newNode = new CustomQuoteNode(node.__key);
                        newNode.__id = node.__id;
                        newNode.__alignment = node.__alignment;
                        newNode.__inset = node.__inset;
                Severity: Major
                Found in resources/js/wysiwyg/nodes/custom-quote.ts and 1 other location - About 1 hr to fix
                resources/js/wysiwyg/nodes/custom-paragraph.ts on lines 57..63

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

                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

                  getDOMCellFromCordsOrThrow(
                    x: number,
                    y: number,
                    table: TableDOMTable,
                  ): TableDOMCell {
                Severity: Major
                Found in resources/js/wysiwyg/lexical/table/LexicalTableNode.ts and 1 other location - About 1 hr to fix
                resources/js/wysiwyg/lexical/table/LexicalTableNode.ts on lines 206..218

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

                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 processUsers has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function processUsers(array $users, UserAvatars $userAvatar): int
                    {
                        $dryRun = !$this->option('force');
                        $this->info(count($users) . " user(s) found to update avatars for.");
                
                
                Severity: Minor
                Found in app/Console/Commands/RefreshAvatarCommand.php - About 1 hr to fix

                Cognitive Complexity

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

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

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

                Further reading

                Function watchMarkerMouseDrags has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected watchMarkerMouseDrags(wrapper: HTMLElement) {
                        const _this = this;
                        let markerStart: number = 0;
                        let markerProp: 'left' | 'top' = 'left';
                
                
                Severity: Minor
                Found in resources/js/wysiwyg/ui/framework/helpers/table-resizer.ts - About 1 hr to fix

                Cognitive Complexity

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

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

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

                Further reading

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

                function $pasteClipboardColumns(editor: LexicalEditor, isBefore: boolean): void {
                    const selection = $getSelection();
                    const table = $getTableFromSelection(selection);
                    const cells = $getTableCellsFromSelection(selection);
                    const referenceCell = cells[isBefore ? 0 : cells.length - 1];
                Severity: Minor
                Found in resources/js/wysiwyg/utils/table-copy-paste.ts - About 1 hr to fix

                Cognitive Complexity

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

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

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

                Further reading

                Function domElementToNode has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                function domElementToNode(tag: MediaNodeTag, element: HTMLElement): MediaNode {
                    const node = $createMediaNode(tag);
                
                    const attributes: Record<string, string> = {};
                    for (const attribute of element.attributes) {
                Severity: Minor
                Found in resources/js/wysiwyg/nodes/media.ts - About 1 hr to fix

                Cognitive Complexity

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

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

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

                Further reading

                Function createRelativePosition has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                function createRelativePosition(
                  point: Point,
                  binding: Binding,
                ): null | RelativePosition {
                  const collabNodeMap = binding.collabNodeMap;
                Severity: Minor
                Found in resources/js/wysiwyg/lexical/yjs/SyncCursors.ts - About 1 hr to fix

                Cognitive Complexity

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

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

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

                Further reading

                Function getNextTextNode has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                function getNextTextNode(startingNode: Node) {
                  let node = startingNode;
                
                  mainLoop: while (node !== null) {
                    if (node !== startingNode && node.nodeType === 3) {
                Severity: Minor
                Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 1 hr to fix

                Cognitive Complexity

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

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

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

                Further reading

                Function splice has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                  splice(
                    binding: Binding,
                    index: number,
                    delCount: number,
                    collabNode?:
                Severity: Minor
                Found in resources/js/wysiwyg/lexical/yjs/CollabElementNode.ts - About 1 hr to fix

                Cognitive Complexity

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

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

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

                Further reading

                Severity
                Category
                Status
                Source
                Language