BookStackApp/BookStack

View on GitHub

Showing 889 of 1,485 total issues

Function reconcileElementTerminatingLineBreak has 37 lines of code (exceeds 25 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 1 hr to fix

    Function createRectsFromDOMRange has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function createRectsFromDOMRange(
      editor: LexicalEditor,
      range: Range,
    ): Array<ClientRect> {
      const rootElement = editor.getRootElement();
    Severity: Minor
    Found in resources/js/wysiwyg/lexical/selection/utils.ts - About 1 hr to fix

      Function $getTableCellNodeRect has 36 lines of code (exceeds 25 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 1 hr to fix

        Function $garbageCollectDetachedNodes has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function $garbageCollectDetachedNodes(
          prevEditorState: EditorState,
          editorState: EditorState,
          dirtyLeaves: Set<NodeKey>,
          dirtyElements: Map<NodeKey, IntentionallyMarkedAsDirtyElement>,
        Severity: Minor
        Found in resources/js/wysiwyg/lexical/core/LexicalGC.ts - About 1 hr to fix

          Function constructor has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            constructor(
              editorState: EditorState,
              parentEditor: null | LexicalEditor,
              nodes: RegisteredNodes,
              config: EditorConfig,
          Severity: Minor
          Found in resources/js/wysiwyg/lexical/core/LexicalEditor.ts - About 1 hr to fix

            Function request has 36 lines of code (exceeds 25 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

              Function init has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              export async function init(editor) {
                  const Code = await window.importVersioned('code');
              
                  /**
                   * @param {ViewUpdate} v
              Severity: Minor
              Found in resources/js/markdown/codemirror.js - 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 getConnection has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function getConnection()
                  {
                      if ($this->ldapConnection !== null) {
                          return $this->ldapConnection;
                      }
              Severity: Minor
              Found in app/Access/LdapService.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 formatSingle has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function formatSingle(Entity $entity): array
                  {
                      $result = [];
                      $values = (clone $entity)->toArray();
              
              
              Severity: Minor
              Found in app/Api/ApiEntityListFormatter.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 parse has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function parse(): int
                  {
                      $nodesAdded = 0;
                      $tags = $this->locateAndIsolateIncludeTags();
              
              
              Severity: Minor
              Found in app/Entities/Tools/PageIncludeParser.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 ensureDeletable has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function ensureDeletable(Entity $entity): void
                  {
                      $customHomeId = intval(explode(':', setting('app-homepage', '0:'))[0]);
                      $customHomeActive = setting('app-homepage-type') === 'page';
                      $removeCustomHome = false;
              Severity: Minor
              Found in app/Entities/Tools/TrashCan.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 wrapContinuousInlines has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              function wrapContinuousInlines(
                domNode: Node,
                nodes: Array<LexicalNode>,
                createWrapperFn: () => ElementNode,
              ): Array<LexicalNode> {
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/html/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 $forEachTableCell has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              export function $forEachTableCell(table: CustomTableNode, callback: (c: CustomTableCellNode) => void|false): void {
                  outer: for (const row of table.getChildren()) {
                      if (!$isCustomTableRowNode(row)) {
                          continue;
                      }
              Severity: Minor
              Found in resources/js/wysiwyg/utils/tables.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 getPositionFromElementAndOffset has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              export function getPositionFromElementAndOffset(
                node: CollabElementNode,
                offset: number,
                boundaryIsEdge: 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 $getOrInitCollabNodeFromSharedType has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              export function $getOrInitCollabNodeFromSharedType(
                binding: Binding,
                sharedType: XmlText | YMap<unknown> | XmlElement,
                parent?: CollabElementNode,
              ):
              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 exportDOM has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                exportDOM(editor: LexicalEditor): DOMExportOutput {
                  return {
                    ...super.exportDOM(editor),
                    after: (tableElement) => {
                      if (!tableElement) {
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/table/LexicalTableNode.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 updateChildrenListItemValue has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              export function updateChildrenListItemValue(list: ListNode): void {
                const isNotChecklist = list.getListType() !== 'check';
                let value = list.getStart();
                for (const child of list.getChildren()) {
                  if ($isListItemNode(child)) {
              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 $normalizePoint has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              function $normalizePoint(point: PointType): void {
                while (point.type === 'element') {
                  const node = point.getNode();
                  const offset = point.offset;
                  let nextNode;
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/core/LexicalNormalization.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 $normalizeTextNode has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              export function $normalizeTextNode(textNode: TextNode): void {
                let node = textNode;
              
                if (node.__text === '' && node.isSimpleText() && !node.isUnmergeable()) {
                  node.remove();
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/core/LexicalNormalization.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 deleteLine has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                deleteLine(isBackward: boolean): void {
                  if (this.isCollapsed()) {
                    // Since `domSelection.modify('extend', ..., 'lineboundary')` works well for text selections
                    // but doesn't properly handle selections which end on elements, a space character is added
                    // for such selections transforming their anchor's type to 'text'
              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

              Severity
              Category
              Status
              Source
              Language