BookStackApp/BookStack

View on GitHub

Showing 889 of 1,485 total issues

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

function $setListItemThemeClassNames(
  dom: HTMLElement,
  editorThemeClasses: EditorThemeClasses,
  node: ListItemNode,
): void {
Severity: Minor
Found in resources/js/wysiwyg/lexical/list/LexicalListItemNode.ts - About 2 hrs 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 register has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function register(editor) {
    editor.ui.registry.addIcon('tableclearformatting', '<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 24 24"><path d="M15.53088 4.64727v-.82364c0-.453-.37063-.82363-.82363-.82363H4.82363C4.37063 3 4 3.37064 4 3.82363v3.29454c0 .453.37064.82364.82363.82364h9.88362c.453 0 .82363-.37064.82363-.82364v-.82363h.82364v3.29454H8.11817v7.4127c0 .453.37064.82364.82364.82364h1.64727c.453 0 .82363-.37064.82363-.82364v-5.76544h6.58907V4.64727Z"/><path d="m18.42672 19.51563-1.54687-1.54688-1.54688 1.54688c-.26751.2675-.70124.2675-.96875 0-.26751-.26752-.26751-.70124 0-.96876L15.9111 17l-1.54688-1.54688c-.26751-.2675-.26751-.70123 0-.96875.26751-.2675.70124-.2675.96875 0l1.54688 1.54688 1.54687-1.54688c.26751-.2675.70124-.2675.96875 0 .26751.26752.26751.70124 0 .96875L17.8486 17l1.54687 1.54688c.26751.2675.26751.70123 0 .96874-.26751.26752-.70124.26752-.96875 0z"/></svg>');

    const tableFirstRowContextSpec = {
        items: ' | tablerowheader',
Severity: Major
Found in resources/js/wysiwyg-tinymce/plugins-table-additions.js - About 2 hrs to fix

    Function $createNode has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function $createNode(
      key: NodeKey,
      parentDOM: null | HTMLElement,
      insertDOM: null | Node,
    ): HTMLElement {
    Severity: Major
    Found in resources/js/wysiwyg/lexical/core/LexicalReconciler.ts - About 2 hrs to fix

      Method index has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function index(
              Request $request,
              ActivityQueries $activities,
              QueryRecentlyViewed $recentlyViewed,
              QueryTopFavourites $topFavourites,
      Severity: Major
      Found in app/App/HomeController.php - About 2 hrs to fix

        Function syncCursorPositions has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function syncCursorPositions(
          binding: Binding,
          provider: Provider,
        ): void {
          const awarenessStates = Array.from(provider.awareness.getStates());
        Severity: Major
        Found in resources/js/wysiwyg/lexical/yjs/SyncCursors.ts - About 2 hrs to fix

          EditorUIManager has 24 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export class EditorUIManager {
          
              protected modalDefinitionsByKey: Record<string, EditorFormModalDefinition> = {};
              protected activeModalsByKey: Record<string, EditorFormModal> = {};
              protected decoratorConstructorsByType: Record<string, typeof EditorDecorator> = {};
          Severity: Minor
          Found in resources/js/wysiwyg/ui/framework/manager.ts - About 2 hrs to fix

            Function $deleteTableColumn__EXPERIMENTAL has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function $deleteTableColumn__EXPERIMENTAL(): void {
              const selection = $getSelection();
              invariant(
                $isRangeSelection(selection) || $isTableSelection(selection),
                'Expected a RangeSelection or TableSelection',
            Severity: Major
            Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 2 hrs to fix

              Function createMergeActionGetter has 66 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function createMergeActionGetter(
                editor: LexicalEditor,
                delay: number,
              ): (
                prevEditorState: null | EditorState,
              Severity: Major
              Found in resources/js/wysiwyg/lexical/history/index.ts - About 2 hrs to fix

                Function $applyAllTransforms has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function $applyAllTransforms(
                  editorState: EditorState,
                  editor: LexicalEditor,
                ): void {
                  const dirtyLeaves = editor._dirtyLeaves;
                Severity: Major
                Found in resources/js/wysiwyg/lexical/core/LexicalUpdates.ts - About 2 hrs to fix

                  Function defineCodeBlockCustomElement has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function defineCodeBlockCustomElement(editor) {
                      const doc = editor.getDoc();
                      const win = doc.defaultView;
                  
                      class CodeBlockElement extends win.HTMLElement {
                  Severity: Minor
                  Found in resources/js/wysiwyg-tinymce/plugin-codeeditor.js - About 2 hrs 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 getChangeType has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function getChangeType(
                    prevEditorState: null | EditorState,
                    nextEditorState: EditorState,
                    dirtyLeavesSet: Set<NodeKey>,
                    dirtyElementsSet: Map<NodeKey, IntentionallyMarkedAsDirtyElement>,
                  Severity: Minor
                  Found in resources/js/wysiwyg/lexical/history/index.ts - About 2 hrs 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 reconcileElementTerminatingLineBreak has a Cognitive Complexity of 19 (exceeds 5 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 2 hrs 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 setRootElement has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                    setRootElement(nextRootElement: null | HTMLElement): void {
                      const prevRootElement = this._rootElement;
                  
                      if (nextRootElement !== prevRootElement) {
                        const classNames = getCachedClassNameArray(this._config.theme, 'root');
                  Severity: Minor
                  Found in resources/js/wysiwyg/lexical/core/LexicalEditor.ts - About 2 hrs 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 select has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                    select(_anchorOffset?: number, _focusOffset?: number): RangeSelection {
                      errorOnReadOnly();
                      const selection = $getSelection();
                      let anchorOffset = _anchorOffset;
                      let focusOffset = _focusOffset;
                  Severity: Minor
                  Found in resources/js/wysiwyg/lexical/core/nodes/LexicalElementNode.ts - About 2 hrs 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 buildForEditor has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function buildForEditor(options) {
                      // Set language
                      window.tinymce.addI18n(options.language, options.translationMap);
                  
                      // BookStack Version
                  Severity: Major
                  Found in resources/js/wysiwyg-tinymce/config.js - About 2 hrs to fix

                    Method formatTextUsingMatchPositions has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function formatTextUsingMatchPositions(array $matchPositions, string $originalText, int $targetLength): string
                        {
                            $maxEnd = mb_strlen($originalText);
                            $fetchAll = ($targetLength === 0);
                            $contextLength = ($fetchAll ? 0 : 32);
                    Severity: Major
                    Found in app/Search/SearchResultsFormatter.php - About 2 hrs to fix

                      Function $wrapNodes has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function $wrapNodes(
                        selection: BaseSelection,
                        createElement: () => ElementNode,
                        wrappingElement: null | ElementNode = null,
                      ): void {
                      Severity: Major
                      Found in resources/js/wysiwyg/lexical/selection/range-selection.ts - About 2 hrs to fix

                        Function $unmergeCell has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function $unmergeCell(): void {
                          const selection = $getSelection();
                          invariant(
                            $isRangeSelection(selection) || $isTableSelection(selection),
                            'Expected a RangeSelection or TableSelection',
                        Severity: Major
                        Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 2 hrs to fix

                          Function $insertTableRow__EXPERIMENTAL has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function $insertTableRow__EXPERIMENTAL(insertAfter = true): void {
                            const selection = $getSelection();
                            invariant(
                              $isRangeSelection(selection) || $isTableSelection(selection),
                              'Expected a RangeSelection or TableSelection',
                          Severity: Major
                          Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 2 hrs to fix

                            Function $convertTableCellNodeElement has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function $convertTableCellNodeElement(
                              domNode: Node,
                            ): DOMConversionOutput {
                              const domNode_ = domNode as HTMLTableCellElement;
                              const nodeName = domNode.nodeName.toLowerCase();
                            Severity: Major
                            Found in resources/js/wysiwyg/lexical/table/LexicalTableCellNode.ts - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language