BookStackApp/BookStack

View on GitHub

Showing 889 of 1,485 total issues

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

export function $getTableCellNodeRect(tableCellNode: TableCellNode): {
  rowIndex: number;
  columnIndex: number;
  rowSpan: number;
  colSpan: number;
Severity: Minor
Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.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 getTable has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

export function getTable(tableElement: HTMLElement): TableDOMTable {
  const domRows: TableDOMRows = [];
  const grid = {
    columns: 0,
    domRows,
Severity: Minor
Found in resources/js/wysiwyg/lexical/table/LexicalTableSelectionHelpers.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 getNodes has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  getNodes(): Array<LexicalNode> {
    const cachedNodes = this._cachedNodes;
    if (cachedNodes !== null) {
      return cachedNodes;
    }
Severity: Minor
Found in resources/js/wysiwyg/lexical/core/LexicalSelection.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 updateDOM has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  updateDOM(
    prevNode: TextNode,
    dom: HTMLElement,
    config: EditorConfig,
  ): boolean {
Severity: Major
Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.ts - About 2 hrs to fix

    Function setupTracker has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        setupTracker(container: HTMLElement, node: NodeHasSize, nodeDOM: HTMLElement): MouseDragTracker {
            let startingWidth: number = 0;
            let startingHeight: number = 0;
            let startingRatio: number = 0;
            let hasHeight = false;
    Severity: Major
    Found in resources/js/wysiwyg/ui/framework/helpers/node-resizer.ts - About 2 hrs to fix

      Function $internalCreateRangeSelection has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function $internalCreateRangeSelection(
        lastSelection: null | BaseSelection,
        domSelection: Selection | null,
        editor: LexicalEditor,
        event: UIEvent | Event | null,
      Severity: Major
      Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 2 hrs to fix

        Function getTable has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function getTable(tableElement: HTMLElement): TableDOMTable {
          const domRows: TableDOMRows = [];
          const grid = {
            columns: 0,
            domRows,
        Severity: Major
        Found in resources/js/wysiwyg/lexical/table/LexicalTableSelectionHelpers.ts - About 2 hrs to fix

          Function init has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async function init() {
          
              const config = {
                nodes: [
                  LinkNode,

            Function selectTableNodeInDirection has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const selectTableNodeInDirection = (
              tableObserver: TableObserver,
              tableNode: TableNode,
              x: number,
              y: number,
            Severity: Major
            Found in resources/js/wysiwyg/lexical/table/LexicalTableSelectionHelpers.ts - About 2 hrs to fix

              Function $updateElementSelectionOnCreateDeleteNode has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function $updateElementSelectionOnCreateDeleteNode(
                selection: RangeSelection,
                parentNode: LexicalNode,
                nodeOffset: number,
                times = 1,
              Severity: Major
              Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 2 hrs to fix

                Function $updateSelectionResolveTextNodes has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function $updateSelectionResolveTextNodes(selection: RangeSelection): void {
                  const anchor = selection.anchor;
                  const anchorOffset = anchor.offset;
                  const focus = selection.focus;
                  const focusOffset = focus.offset;
                Severity: Major
                Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 2 hrs to fix

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

                  export function $getSelectionStyleValueForProperty(
                    selection: RangeSelection | TableSelection,
                    styleProperty: string,
                    defaultValue = '',
                  ): string {
                  Severity: Minor
                  Found in resources/js/wysiwyg/lexical/selection/range-selection.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 $updateCaretSelectionForUnicodeCharacter has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function $updateCaretSelectionForUnicodeCharacter(
                    selection: RangeSelection,
                    isBackward: boolean,
                  ): void {
                    const anchor = selection.anchor;
                  Severity: Minor
                  Found in resources/js/wysiwyg/lexical/core/LexicalSelection.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 $internalCreateRangeSelection has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function $internalCreateRangeSelection(
                    lastSelection: null | BaseSelection,
                    domSelection: Selection | null,
                    editor: LexicalEditor,
                    event: UIEvent | Event | null,
                  Severity: Minor
                  Found in resources/js/wysiwyg/lexical/core/LexicalSelection.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 choice has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      choice(translation: string, count: number, replacements: Record<string, string> = {}): string {
                          const splitText = translation.split('|');
                          const exactCountRegex = /^{([0-9]+)}/;
                          const rangeRegex = /^\[([0-9]+),([0-9*]+)]/;
                          let result = null;
                  Severity: Minor
                  Found in resources/js/services/translations.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 scrollIntoViewIfNeeded has a Cognitive Complexity of 16 (exceeds 5 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 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 $getAdjacentNode has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function $getAdjacentNode(
                    focus: PointType,
                    isBackward: boolean,
                  ): null | LexicalNode {
                    const focusOffset = focus.offset;
                  Severity: Minor
                  Found in resources/js/wysiwyg/lexical/core/LexicalUtils.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 copyToClipboard has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export async function copyToClipboard(
                    editor: LexicalEditor,
                    event: null | ClipboardEvent,
                    data?: LexicalClipboardData,
                  ): Promise<boolean> {
                  Severity: Major
                  Found in resources/js/wysiwyg/lexical/clipboard/clipboard.ts - About 2 hrs to fix

                    Function createDOMRange has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function createDOMRange(
                      editor: LexicalEditor,
                      anchorNode: LexicalNode,
                      _anchorOffset: number,
                      focusNode: LexicalNode,
                    Severity: Major
                    Found in resources/js/wysiwyg/lexical/selection/utils.ts - About 2 hrs to fix

                      Function $computeTableMapSkipCellCheck has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function $computeTableMapSkipCellCheck(
                        grid: TableNode,
                        cellA: null | TableCellNode,
                        cellB: null | TableCellNode,
                      ): [TableMapType, TableMapValueType | null, TableMapValueType | null] {
                      Severity: Major
                      Found in resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language