knsv/mermaid

View on GitHub

Showing 429 of 1,682 total issues

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

export const drawPopup = function (elem, actor, minMenuWidth, textAttrs, forceMenus) {
  if (actor.links === undefined || actor.links === null || Object.keys(actor.links).length === 0) {
    return { height: 0, width: 0 };
  }

Severity: Major
Found in packages/mermaid/src/diagrams/sequence/svgDraw.js - About 2 hrs to fix

    File blockDB.ts has 251 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import clone from 'lodash-es/clone.js';
    import * as configApi from '../../config.js';
    import { getConfig } from '../../diagram-api/diagramAPI.js';
    import type { DiagramDB } from '../../diagram-api/types.js';
    import { log } from '../../logger.js';
    Severity: Minor
    Found in packages/mermaid/src/diagrams/block/blockDB.ts - About 2 hrs to fix

      Function addState has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const addState = function (
        id,
        type = DEFAULT_STATE_TYPE,
        doc = null,
        descr = null,
      Severity: Minor
      Found in packages/mermaid/src/diagrams/state/stateDb.js - About 2 hrs to fix

        Function draw has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const draw = (text, id, version) => {
          try {
            const conf = getConfig();
            log.debug('Rendering example diagram\n' + text, 'Conf: ');
            const THEME_COLOR_LIMIT = getConfig().themeVariables.THEME_COLOR_LIMIT;
        Severity: Minor
        Found in packages/mermaid-example-diagram/src/exampleDiagramRenderer.js - About 2 hrs to fix

          Function addVertex has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const addVertex = function (
            id: string,
            textObj: FlowText,
            type: 'group',
            style: string[],
          Severity: Minor
          Found in packages/mermaid/src/diagrams/flowchart/flowDb.ts - About 2 hrs to fix

            Function addSubGraph has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const addSubGraph = function (
              _id: { text: string },
              list: string[],
              _title: { text: string; type: string }
            ) {
            Severity: Minor
            Found in packages/mermaid/src/diagrams/flowchart/flowDb.ts - About 1 hr to fix

              Function insertLineEndings has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const insertLineEndings = (parentNode, conf) => {
                let containsNode = parentNode
                  .append('defs')
                  .append('marker')
                  .attr('id', ReqMarkers.CONTAINS + '_line_ending')
              Severity: Minor
              Found in packages/mermaid/src/diagrams/requirement/requirementMarkers.js - About 1 hr to fix

                Function addRelations has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const addRelations = function (relations: ClassRelation[], g: graphlib.Graph) {
                  const conf = getConfig().flowchart;
                  let cnt = 0;
                
                  relations.forEach(function (edge) {
                Severity: Minor
                Found in packages/mermaid/src/diagrams/class/classRenderer-v2.ts - About 1 hr to fix

                  Function addPersonOrSystem has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const addPersonOrSystem = function (typeC4Shape, alias, label, descr, sprite, tags, link) {
                    // Don't allow label nulling
                    if (alias === null || label === null) {
                      return;
                    }
                  Severity: Minor
                  Found in packages/mermaid/src/diagrams/c4/c4Db.js - About 1 hr to fix

                    Function forkJoin has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const forkJoin = (parent: SVG, node: Node, dir: string) => {
                      const { themeVariables } = getConfig();
                      const { lineColor } = themeVariables;
                      const shapeSvg = parent
                        .insert('g')

                      Function drawTasks has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const drawTasks = function (
                        diagram: Selection<SVGElement, unknown, null, undefined>,
                        tasks: TimelineTask[],
                        sectionColor: number,
                        masterX: number,
                      Severity: Minor
                      Found in packages/mermaid/src/diagrams/timeline/timelineRenderer.ts - About 1 hr to fix

                        Function drawCommits has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const drawCommits = (
                          svg: d3.Selection<d3.BaseType, unknown, HTMLElement, any>,
                          commits: Map<string, Commit>,
                          modifyGraph: boolean
                        ) => {
                        Severity: Minor
                        Found in packages/mermaid/src/diagrams/git/gitGraphRenderer.ts - About 1 hr to fix

                          Function genSections has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const genSections = (options) => {
                            let sections = '';
                          
                            for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) {
                              options['lineColor' + i] = options['lineColor' + i] || options['cScaleInv' + i];
                          Severity: Minor
                          Found in packages/mermaid/src/diagrams/timeline/styles.js - About 1 hr to fix

                            Function divider has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const divider = (parent, node) => {
                              const siteConfig = getConfig();
                            
                              const { themeVariables, handDrawnSeed } = siteConfig;
                              const { nodeBorder } = themeVariables;
                            Severity: Minor
                            Found in packages/mermaid/src/rendering-util/rendering-elements/clusters.js - About 1 hr to fix

                              Function parseData has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

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

                                Function fixCorners has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const fixCorners = function (lineData) {
                                  const { cornerPointPositions } = extractCornerPoints(lineData);
                                  const newLineData = [];
                                  for (let i = 0; i < lineData.length; i++) {
                                    if (cornerPointPositions.includes(i)) {
                                Severity: Minor
                                Found in packages/mermaid/src/rendering-util/rendering-elements/edges.js - About 1 hr to fix

                                  Function choice has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export const choice = (parent: SVG, node: Node) => {
                                    const { labelStyles, nodeStyles } = styles2String(node);
                                    node.labelStyle = labelStyles;
                                    const { themeVariables } = getConfig();
                                    const { lineColor } = themeVariables;

                                    Function draw has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export const draw = (text, id, _version, diagObj) => {
                                      conf = getConfig().requirement;
                                    
                                      const securityLevel = conf.securityLevel;
                                      // Handle root and Document for when rendering in sandbox mode
                                    Severity: Minor
                                    Found in packages/mermaid/src/diagrams/requirement/requirementRenderer.js - About 1 hr to fix

                                      Function calculateTextDimensions has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        (text: string, config: TextDimensionConfig): TextDimensions => {
                                          const { fontSize = 12, fontFamily = 'Arial', fontWeight = 400 } = config;
                                          if (!text) {
                                            return { width: 0, height: 0 };
                                          }
                                      Severity: Minor
                                      Found in packages/mermaid/src/utils.ts - About 1 hr to fix

                                        Function styles2String has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        export const styles2String = (node: Node) => {
                                          const { stylesArray } = compileStyles(node);
                                          const labelStyles: string[] = [];
                                          const nodeStyles: string[] = [];
                                          const borderStyles: string[] = [];
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language