BookStackApp/BookStack

View on GitHub

Showing 1,485 of 1,485 total issues

Function registerCommonNodeMutationListeners has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function registerCommonNodeMutationListeners(context: EditorUiContext): void {
    const decorated = [ImageNode, CodeBlockNode, DiagramNode];

    const decorationDestroyListener = (mutations: Map<string, NodeMutation>): void => {
        for (let [nodeKey, mutation] of mutations) {
Severity: Minor
Found in resources/js/wysiwyg/nodes/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 isExcludedProperty has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function isExcludedProperty(
  name: string,
  node: LexicalNode,
  binding: Binding,
): boolean {
Severity: Minor
Found in resources/js/wysiwyg/lexical/yjs/Utils.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 $handleListInsertParagraph has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function $handleListInsertParagraph(): boolean {
  const selection = $getSelection();

  if (!$isRangeSelection(selection) || !selection.isCollapsed()) {
    return false;
Severity: Minor
Found in resources/js/wysiwyg/lexical/list/formatList.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 onDocumentSelectionChange has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function onDocumentSelectionChange(event: Event): void {
  const target = event.target as null | Element | Document;
  const targetWindow =
    target == null
      ? null
Severity: Minor
Found in resources/js/wysiwyg/lexical/core/LexicalEvents.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 forwardDeletion has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  forwardDeletion(
    anchor: PointType,
    anchorNode: TextNode | ElementNode,
    isBackward: boolean,
  ): boolean {
Severity: Minor
Found in resources/js/wysiwyg/lexical/core/LexicalSelection.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 $internalResolveSelectionPoints has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function $internalResolveSelectionPoints(
  anchorDOM: null | Node,
  anchorOffset: number,
  focusDOM: null | Node,
  focusOffset: number,
Severity: Minor
Found in resources/js/wysiwyg/lexical/core/LexicalSelection.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 selectPointOnNode has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function selectPointOnNode(point: PointType, node: LexicalNode): void {
  let key = node.__key;
  let offset = point.offset;
  let type: 'element' | 'text' = 'element';
  if ($isTextNode(node)) {
Severity: Minor
Found in resources/js/wysiwyg/lexical/core/LexicalSelection.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 $splitNodeAtPoint has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function $splitNodeAtPoint(
  node: LexicalNode,
  offset: number,
): [parent: ElementNode, offset: number] {
  const parent = node.getParent();
Severity: Minor
Found in resources/js/wysiwyg/lexical/core/LexicalSelection.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 getChildAtIndex has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  getChildAtIndex<T extends LexicalNode>(index: number): null | T {
    const size = this.getChildrenSize();
    let node: null | T;
    let i;
    if (index < size / 2) {
Severity: Minor
Found in resources/js/wysiwyg/lexical/core/nodes/LexicalElementNode.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 request has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected async request(url: string, options: RequestOptions & RequestInit = {}): Promise<FormattedResponse> {
        let requestUrl = url;

        if (!requestUrl.startsWith('http')) {
            requestUrl = window.baseUrl(requestUrl);
Severity: Minor
Found in resources/js/services/http.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 exportDOM has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  exportDOM(editor: LexicalEditor): DOMExportOutput {
    let {element} = super.exportDOM(editor);
    invariant(
      element !== null && isHTMLElement(element),
      'Expected TextNode createDOM to always return a HTMLElement',
Severity: Minor
Found in resources/js/wysiwyg/lexical/core/nodes/LexicalTextNode.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 $shouldInsertTextAfterOrBeforeTextNode has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function $shouldInsertTextAfterOrBeforeTextNode(
  selection: RangeSelection,
  node: TextNode,
): boolean {
  if (node.isSegmented()) {
Severity: Minor
Found in resources/js/wysiwyg/lexical/core/LexicalUtils.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 $garbageCollectDetachedDeepChildNodes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function $garbageCollectDetachedDeepChildNodes(
  node: ElementNode,
  parentKey: NodeKey,
  prevNodeMap: NodeMap,
  nodeMap: NodeMap,
Severity: Minor
Found in resources/js/wysiwyg/lexical/core/LexicalGC.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

Method loadFromJwkArray has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function loadFromJwkArray(array $jwk)
    {
        // 'alg' is optional for a JWK, but we will still attempt to validate if
        // it exists otherwise presume it will be compatible.
        $alg = $jwk['alg'] ?? null;
Severity: Minor
Found in app/Access/Oidc/OidcJwtSigningKey.php - About 1 hr to fix

    Method checkUserHasAccessToRelationOfImageAtPath has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function checkUserHasAccessToRelationOfImageAtPath(string $path): bool
        {
            if (str_starts_with($path, 'uploads/images/')) {
                $path = substr($path, 15);
            }
    Severity: Minor
    Found in app/Uploads/ImageService.php - About 1 hr to fix

      Method getProviderSettings has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function getProviderSettings(): OidcProviderSettings
          {
              $config = $this->config();
              $settings = new OidcProviderSettings([
                  'issuer'                => $config['issuer'],
      Severity: Minor
      Found in app/Access/Oidc/OidcService.php - About 1 hr to fix

        Function updateDOM has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            updateDOM(prevNode: MediaNode, dom: HTMLElement): boolean {
                if (prevNode.__tag !== this.__tag) {
                    return true;
                }
        
        
        Severity: Minor
        Found in resources/js/wysiwyg/nodes/media.ts - About 1 hr to fix

          Function buildDOM has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              buildDOM(): HTMLElement {
          
                  const colorOptions = colorChoices.map(choice => {
                      return el('div', {
                          class: 'editor-color-select-option',
          Severity: Minor
          Found in resources/js/wysiwyg/ui/framework/blocks/color-picker.ts - About 1 hr to fix

            Function getWordsFromString has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const getWordsFromString = function (string: string): Array<Segment> {
                const segments: Segment[] = [];
                let wordString = '';
                let nonWordString = '';
                let i;
            Severity: Minor
            Found in resources/js/wysiwyg/lexical/selection/__tests__/utils/index.ts - About 1 hr to fix

              Function $copyToClipboardEvent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function $copyToClipboardEvent(
                editor: LexicalEditor,
                event: ClipboardEvent,
                data?: LexicalClipboardData,
              ): boolean {
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/clipboard/clipboard.ts - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language