BookStackApp/BookStack

View on GitHub

Showing 889 of 1,485 total issues

Function getCachedTypeToNodeMap has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function getCachedTypeToNodeMap(
  editorState: EditorState,
): TypeToNodeMap {
  // If this is a new Editor it may have a writable this._editorState
  // with only a 'root' entry.
Severity: Minor
Found in resources/js/wysiwyg/lexical/core/LexicalUtils.ts - About 35 mins 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 insertNewAfter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  insertNewAfter(
    selection?: RangeSelection,
    restoreSelection = true,
  ): ParagraphNode | HeadingNode {
    const anchorOffet = selection ? selection.anchor.offset : 0;
Severity: Minor
Found in resources/js/wysiwyg/lexical/rich-text/index.ts - About 35 mins 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 $nodesOfType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function $nodesOfType<T extends LexicalNode>(klass: Klass<T>): Array<T> {
  const klassType = klass.getType();
  const editorState = getActiveEditorState();
  if (editorState._readOnly) {
    const nodes = getCachedTypeToNodeMap(editorState).get(klassType) as
Severity: Minor
Found in resources/js/wysiwyg/lexical/core/LexicalUtils.ts - About 35 mins 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 $garbageCollectDetachedDecorators has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function $garbageCollectDetachedDecorators(
  editor: LexicalEditor,
  pendingEditorState: EditorState,
): void {
  const currentDecorators = editor._decorators;
Severity: Minor
Found in resources/js/wysiwyg/lexical/core/LexicalGC.ts - About 35 mins 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

Avoid too many return statements within this function.
Open

        return false;
Severity: Major
Found in resources/js/components/shortcuts.js - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return false;
    Severity: Major
    Found in app/Uploads/ImageService.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return $this->storage->getPublicUrl($thumbFilePath);
      Severity: Major
      Found in app/Uploads/ImageResizer.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return $this->queries->shelves->visibleForList()->where('id', '=', $image->uploaded_to)->exists();
        Severity: Major
        Found in app/Uploads/ImageService.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return self::FAILURE;
          Severity: Major
          Found in app/Console/Commands/RefreshAvatarCommand.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return $this->queries->books->visibleForList()->where('id', '=', $image->uploaded_to)->exists();
            Severity: Major
            Found in app/Uploads/ImageService.php - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return 'justify'
              Severity: Major
              Found in resources/js/wysiwyg/nodes/_common.ts - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return $image->url;
                Severity: Major
                Found in app/Entities/Tools/PageContent.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return '';
                  Severity: Major
                  Found in app/Entities/Tools/PageContent.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return 0;
                    Severity: Major
                    Found in app/Entities/Tools/TrashCan.php - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return '';
                      Severity: Major
                      Found in resources/js/wysiwyg/nodes/_common.ts - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return true;
                        Severity: Major
                        Found in app/Entities/Tools/BookContents.php - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                            return true;
                          Severity: Major
                          Found in resources/js/wysiwyg/lexical/clipboard/clipboard.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return;
                            Severity: Major
                            Found in resources/js/wysiwyg/lexical/yjs/SyncCursors.ts - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return;
                              Severity: Major
                              Found in resources/js/wysiwyg/lexical/yjs/SyncCursors.ts - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                  return collabNode;
                                Severity: Major
                                Found in resources/js/wysiwyg/lexical/yjs/Utils.ts - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language