knsv/mermaid

View on GitHub

Showing 384 of 1,490 total issues

Function drawLabel has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const drawLabel = function (elem, txtObject) {
  /**
   * @param {any} x
   * @param {any} y
   * @param {any} width
Severity: Minor
Found in packages/mermaid/src/diagrams/user-journey/svgDraw.js - About 1 hr to fix

    Function contentLoaded has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const contentLoaded = async function () {
      let pos = document.location.href.indexOf('?graph=');
      if (pos > 0) {
        pos = pos + 7;
        const graphBase64 = document.location.href.substr(pos);
    Severity: Minor
    Found in cypress/platform/viewer.js - About 1 hr to fix

      Function addRelationObjs has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function addRelationObjs(item1, item2, relationTitle) {
        let id1 = startIdIfNeeded(item1.id.trim());
        let type1 = startTypeIfNeeded(item1.id.trim(), item1.type);
        let id2 = startIdIfNeeded(item2.id.trim());
        let type2 = startTypeIfNeeded(item2.id.trim(), item2.type);
      Severity: Minor
      Found in packages/mermaid/src/diagrams/state/stateDb.js - About 1 hr to fix

        Function renderKatex has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const renderKatex = async (text: string, config: MermaidConfig): Promise<string> => {
          if (!hasKatex(text)) {
            return text;
          }
        
        
        Severity: Minor
        Found in packages/mermaid/src/diagrams/common/common.ts - About 1 hr to fix

          Function byTspan has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            function byTspan(content, g, x, y, width, height, textAttrs, conf, colour) {
          Severity: Major
          Found in packages/mermaid/src/diagrams/user-journey/svgDraw.js - About 1 hr to fix

            Function byTspan has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              function byTspan(content, g, x, y, width, height, textAttrs, conf, colour) {
            Severity: Major
            Found in packages/mermaid/src/diagrams/timeline/svgDraw.js - About 1 hr to fix

              Function addRel has 9 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              export const addRel = function (type, from, to, label, techn, descr, sprite, tags, link) {
              Severity: Major
              Found in packages/mermaid/src/diagrams/c4/c4Db.js - About 1 hr to fix

                Function insertNode has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const insertNode = async (elem, node, dir) => {
                  let newEl;
                  let el;
                
                  // Add link when appropriate
                Severity: Minor
                Found in packages/mermaid/src/dagre-wrapper/nodes.js - About 1 hr to fix

                  Function createCssStyles has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const createCssStyles = (
                    config: MermaidConfig,
                    classDefs: Record<string, DiagramStyleClassDef> | null | undefined = {}
                  ): string => {
                    let cssStyles = '';
                  Severity: Minor
                  Found in packages/mermaid/src/mermaidAPI.ts - About 1 hr to fix

                    Function setupToolTips has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const setupToolTips = function (element: Element) {
                      let tooltipElem: Selection<HTMLDivElement, unknown, HTMLElement, unknown> =
                        select('.mermaidTooltip');
                      // @ts-expect-error - Incorrect types
                      if ((tooltipElem._groups || tooltipElem)[0][0] === null) {
                    Severity: Minor
                    Found in packages/mermaid/src/diagrams/class/classDb.ts - About 1 hr to fix

                      Function getMaxChildSize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const getMaxChildSize = (block: Block) => {
                        let maxWidth = 0;
                        let maxHeight = 0;
                        // find max width of children
                        // log.debug('getMaxChildSize abc95 (start) parent:', block.id);
                      Severity: Minor
                      Found in packages/mermaid/src/diagrams/block/layout.ts - About 1 hr to fix

                        Function getQuadrantPoints has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          getQuadrantPoints(spaceData: CalculateSpaceData): QuadrantPointType[] {
                            const { quadrantSpace } = spaceData;
                        
                            const { quadrantHeight, quadrantLeft, quadrantTop, quadrantWidth } = quadrantSpace;
                        
                        
                        Severity: Minor
                        Found in packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts - About 1 hr to fix

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

                          function intersectLine(p1, p2, q1, q2) {
                            // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,
                            // p7 and p473.
                          
                            var a1, a2, b1, b2, c1, c2;
                          Severity: Minor
                          Found in packages/mermaid/src/dagre-wrapper/intersect/intersect-line.js - About 1 hr to fix

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

                            const subroutine = async (parent, node) => {
                              const { shapeSvg, bbox } = await labelHelper(
                                parent,
                                node,
                                getClassesFromNode(node, undefined),
                            Severity: Minor
                            Found in packages/mermaid/src/dagre-wrapper/nodes.js - About 1 hr to fix

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

                              export const loadRegisteredDiagrams = async () => {
                                log.debug(`Loading registered diagrams`);
                                // Load all lazy loaded diagrams in parallel
                                const results = await Promise.allSettled(
                                  Object.entries(detectors).map(async ([key, { detector, loader }]) => {
                              Severity: Minor
                              Found in packages/mermaid/src/diagram-api/loadDiagram.ts - About 1 hr to fix

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

                                const setupToolTips = function (element) {
                                  let tooltipElem = select('.mermaidTooltip');
                                  if ((tooltipElem._groups || tooltipElem)[0][0] === null) {
                                    tooltipElem = select('body').append('div').attr('class', 'mermaidTooltip').style('opacity', 0);
                                  }
                                Severity: Minor
                                Found in packages/mermaid/src/diagrams/flowchart/flowDb.js - About 1 hr to fix

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

                                  export const sanitize = (options: any) => {
                                    if (!options) {
                                      return;
                                    }
                                    // Checking that options are not in the list of excluded options
                                  Severity: Minor
                                  Found in packages/mermaid/src/config.ts - About 1 hr to fix

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

                                    const insertEdge = function (edgesEl, edge, edgeData, diagObj, parentLookupDb, id) {
                                      const offset = calcOffset(edge.sourceId, edge.targetId, parentLookupDb);
                                    
                                      const src = edge.sections[0].startPoint;
                                      const dest = edge.sections[0].endPoint;
                                    Severity: Minor
                                    Found in packages/mermaid/src/diagrams/flowchart/elk/flowRenderer-elk.js - About 1 hr to fix

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

                                      function createFormattedText(
                                        width: number,
                                        g: any,
                                        structuredText: MarkdownWord[][],
                                        addBackground = false
                                      Severity: Minor
                                      Found in packages/mermaid/src/rendering-util/createText.ts - About 1 hr to fix

                                        Function drawNode has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        export const drawNode = function (elem, node, fullSection, conf) {
                                          const section = (fullSection % MAX_SECTIONS) - 1;
                                          const nodeElem = elem.append('g');
                                          node.section = section;
                                          nodeElem.attr(
                                        Severity: Minor
                                        Found in packages/mermaid/src/diagrams/timeline/svgDraw.js - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language