knsv/mermaid

View on GitHub

Showing 429 of 1,682 total issues

Function newTitleNode has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const newTitleNode = (parentNode, id, txts) => {
  let x = conf.rect_min_width / 2;

  let title = parentNode
    .append('text')
Severity: Minor
Found in packages/mermaid/src/diagrams/requirement/requirementRenderer.js - About 1 hr to fix

    Function compileTasks has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const compileTasks = function () {
      const compileTask = function (pos) {
        const task = rawTasks[pos];
        let startTime = '';
        switch (rawTasks[pos].raw.startTime.type) {
    Severity: Minor
    Found in packages/mermaid/src/diagrams/gantt/ganttDb.js - About 1 hr to fix

      Function getDrawableElement has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        getDrawableElement(): DrawableElem[] {
          const finalData: [number, number][] = this.barData.data.map((d) => [
            this.xAxis.getScaleValue(d[0]),
            this.yAxis.getScaleValue(d[1]),
          ]);

        Function drawTask has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const drawTask = function (elem, task, conf) {
          const center = task.x + conf.width / 2;
          const g = elem.append('g');
          taskCount++;
          const maxHeight = 300 + 5 * 30;
        Severity: Minor
        Found in packages/mermaid/src/diagrams/timeline/svgDraw.js - About 1 hr to fix

          Function createLabel has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const createLabel = (_vertexText, style, isTitle, isNode) => {
            let vertexText = _vertexText || '';
            if (typeof vertexText === 'object') {
              vertexText = vertexText[0];
            }
          Severity: Minor
          Found in packages/mermaid/src/dagre-wrapper/createLabel.js - About 1 hr to fix

            Function note has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const note = async (parent: SVGAElement, node: Node) => {
              const { themeVariables, handDrawnSeed } = getConfig();
              const { noteBorderColor, noteBkgColor } = themeVariables;
            
              const useHtmlLabels = node.useHtmlLabels;

              Function drawEntities has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const drawEntities = function (svgNode, entities, graph) {
                const keys = [...entities.keys()];
                let firstOne;
              
                keys.forEach(function (entityName) {
              Severity: Minor
              Found in packages/mermaid/src/diagrams/er/erRenderer.js - About 1 hr to fix

                Function destructEndLink has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const destructEndLink = (_str: string) => {
                  const str = _str.trim();
                  let line = str.slice(0, -1);
                  let type = 'arrow_open';
                
                
                Severity: Minor
                Found in packages/mermaid/src/diagrams/flowchart/flowDb.ts - About 1 hr to fix

                  Function docTranslator has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const docTranslator = (parent, node, first) => {
                    if (node.stmt === STMT_RELATION) {
                      docTranslator(parent, node.state1, true);
                      docTranslator(parent, node.state2, false);
                    } else {
                  Severity: Minor
                  Found in packages/mermaid/src/diagrams/state/stateDb.js - About 1 hr to fix

                    Function boundMessage has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    async function boundMessage(_diagram, msgModel): Promise<number> {
                      bounds.bumpVerticalPos(10);
                      const { startx, stopx, message } = msgModel;
                      const lines = common.splitBreaks(message).length;
                      const isKatexMsg = hasKatex(message);
                    Severity: Minor
                    Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts - About 1 hr to fix

                      Function wrap has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function wrap(text, width) {
                        text.each(function () {
                          var text = select(this),
                            words = text
                              .text()
                      Severity: Minor
                      Found in packages/mermaid/src/diagrams/timeline/svgDraw.js - About 1 hr to fix

                        Function getBuildConfig has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const getBuildConfig = (options: MermaidBuildOptions): BuildOptions => {
                          const { core, entryName, metafile, format, minify } = options;
                          const external: string[] = ['require', 'fs', 'path'];
                          const { name, file, packageName } = packageOptions[entryName];
                          const outFileName = getFileName(name, options);
                        Severity: Minor
                        Found in .esbuild/util.ts - About 1 hr to fix

                          Function rect_left_inv_arrow has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const rect_left_inv_arrow = async (
                            parent: SVGAElement,
                            node: Node
                          ): Promise<SVGAElement> => {
                            const { labelStyles, nodeStyles } = styles2String(node);

                            Function setClickFunc has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const setClickFunc = function (_domId: string, functionName: string, functionArgs: string) {
                              const domId = common.sanitizeText(_domId, getConfig());
                              const config = getConfig();
                              if (config.securityLevel !== 'loose') {
                                return;
                            Severity: Minor
                            Found in packages/mermaid/src/diagrams/class/classDb.ts - About 1 hr to fix

                              Function contentLoadedApi has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const contentLoadedApi = 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 compileData has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const compileData = function (prevTask, dataStr) {
                                  let ds;
                                
                                  if (dataStr.substr(0, 1) === ':') {
                                    ds = dataStr.substr(1, dataStr.length);
                                Severity: Minor
                                Found in packages/mermaid/src/diagrams/gantt/ganttDb.js - About 1 hr to fix

                                  Function lean_left has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export const lean_left = async (parent: SVGAElement, node: Node): Promise<SVGAElement> => {
                                    const { labelStyles, nodeStyles } = styles2String(node);
                                    node.labelStyle = labelStyles;
                                    const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
                                  
                                  

                                    Function createStadiumPathD has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export const createStadiumPathD = (
                                      x: number,
                                      y: number,
                                      totalWidth: number,
                                      totalHeight: number

                                      Function trapezoid has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      export const trapezoid = async (parent: SVGAElement, node: Node): Promise<SVGAElement> => {
                                        const { labelStyles, nodeStyles } = styles2String(node);
                                        node.labelStyle = labelStyles;
                                        const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
                                      
                                      

                                        Function lean_right has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        export const lean_right = async (parent: SVGAElement, node: Node): Promise<SVGAElement> => {
                                          const { labelStyles, nodeStyles } = styles2String(node);
                                          node.labelStyle = labelStyles;
                                          const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
                                        
                                        
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language