knsv/mermaid

View on GitHub

Showing 384 of 1,490 total issues

File mermaid-graphlib.js has 385 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/** Decorates with functions required by mermaids dagre-wrapper. */
import { log } from '../logger.js';
import * as graphlibJson from 'dagre-d3-es/src/graphlib/json.js';
import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';

Severity: Minor
Found in packages/mermaid/src/dagre-wrapper/mermaid-graphlib.js - About 5 hrs to fix

    Function setupNode has 128 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const setupNode = (g, parent, parsedItem, diagramStates, diagramDb, altFlag) => {
      const itemId = parsedItem.id;
      const classStr = getClassesFromDbInfo(diagramStates[itemId]);
    
      if (itemId !== 'root') {
    Severity: Major
    Found in packages/mermaid/src/diagrams/state/stateRenderer-v2.js - About 5 hrs to fix

      File shapes.js has 374 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { line, curveBasis } from 'd3';
      import idCache from './id-cache.js';
      import stateDb from './stateDb.js';
      import utils from '../../utils.js';
      import common from '../common/common.js';
      Severity: Minor
      Found in packages/mermaid/src/diagrams/state/shapes.js - About 5 hrs to fix

        Function drawEdge has 124 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const drawEdge = function (elem, path, relation, conf, diagObj) {
          const getRelationType = function (type) {
            switch (type) {
              case diagObj.db.relationType.AGGREGATION:
                return 'aggregation';
        Severity: Major
        Found in packages/mermaid/src/diagrams/class/svgDraw.js - About 4 hrs to fix

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

          export const draw = (txt: string, id: string, _version: string, diagObj: Diagram) => {
            function getDominantBaseLine(horizontalPos: TextHorizontalPos) {
              return horizontalPos === 'top' ? 'hanging' : 'middle';
            }
          
          
          Severity: Major
          Found in packages/mermaid/src/diagrams/quadrant-chart/quadrantRenderer.ts - About 4 hrs to fix

            File classDb.ts has 372 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import type { Selection } from 'd3';
            import { select } from 'd3';
            import { log } from '../../logger.js';
            import { getConfig } from '../../diagram-api/diagramAPI.js';
            import common from '../common/common.js';
            Severity: Minor
            Found in packages/mermaid/src/diagrams/class/classDb.ts - About 4 hrs to fix

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

              export const draw: DrawDefinition = (text, id, _version, diagObj) => {
                log.debug('rendering pie chart\n' + text);
                const db = diagObj.db as PieDB;
                const globalConfig: MermaidConfig = getConfig();
                const pieConfig: Required<PieDiagramConfig> = cleanAndMerge(db.getConfig(), globalConfig.pie);
              Severity: Major
              Found in packages/mermaid/src/diagrams/pie/pieRenderer.ts - About 4 hrs to fix

                Function drawText has 121 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const drawText = function (elem, textData) {
                  let prevTextHeight = 0;
                  let textHeight = 0;
                  const lines = textData.text.split(common.lineBreakRegex);
                
                
                Severity: Major
                Found in packages/mermaid/src/diagrams/sequence/svgDraw.js - About 4 hrs to fix

                  File stateDiagram.spec.js has 367 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
                  
                  describe('State diagram', () => {
                    it('should render a simple state diagrams', () => {
                      imgSnapshotTest(
                  Severity: Minor
                  Found in cypress/integration/rendering/stateDiagram.spec.js - About 4 hrs to fix

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

                    export const draw = function (text: string, id: string, _version: string, diagObj: Diagram): void {
                      // Get Sankey config
                      const { securityLevel, sankey: conf } = getConfig();
                      const defaultSankeyConfig = defaultConfig!.sankey!;
                    
                    
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/sankey/sankeyRenderer.ts - About 4 hrs to fix

                      File block.spec.js has 361 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { imgSnapshotTest } from '../../helpers/util';
                      /* eslint-disable no-useless-escape */
                      describe('Block diagram', () => {
                        it('BL1: should calculate the block widths', () => {
                          imgSnapshotTest(
                      Severity: Minor
                      Found in cypress/integration/rendering/block.spec.js - About 4 hrs to fix

                        Function recursiveRender has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const recursiveRender = async (_elem, graph, diagramType, id, parentCluster, siteConfig) => {
                          log.info('Graph in recursive render: XXX', graphlibJson.write(graph), parentCluster);
                          const dir = graph.graph().rankdir;
                          log.trace('Dir in recursive render - dir:', dir);
                        
                        
                        Severity: Major
                        Found in packages/mermaid/src/dagre-wrapper/index.js - About 4 hrs to fix

                          Function addEdges has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const addEdges = async function (edges, g, diagObj) {
                            log.info('abc78 edges = ', edges);
                            let cnt = 0;
                            let linkIdCnt = {};
                          
                          
                          Severity: Major
                          Found in packages/mermaid/src/diagrams/flowchart/flowRenderer-v2.js - About 4 hrs to fix

                            File edges.js has 353 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { log } from '../logger.js';
                            import createLabel from './createLabel.js';
                            import { createText } from '../rendering-util/createText.js';
                            import { line, curveBasis, select } from 'd3';
                            import { getConfig } from '../diagram-api/diagramAPI.js';
                            Severity: Minor
                            Found in packages/mermaid/src/dagre-wrapper/edges.js - About 4 hrs to fix

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

                              export const draw = async function (text, id, _version, diagObj) {
                                log.info('Drawing flowchart');
                              
                                // Fetch the default direction, use TD if none was found
                                let dir = diagObj.db.getDirection();
                              Severity: Major
                              Found in packages/mermaid/src/diagrams/flowchart/flowRenderer-v2.js - About 4 hrs to fix

                                Function setBlockSizes has 111 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function setBlockSizes(block: Block, db: BlockDB, siblingWidth = 0, siblingHeight = 0) {
                                  log.debug(
                                    'setBlockSizes abc95 (start)',
                                    block.id,
                                    block?.size?.x,
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/block/layout.ts - About 4 hrs to fix

                                  File stateDiagram-v2.spec.js has 351 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import { parser } from './parser/stateDiagram.jison';
                                  import stateDb from './stateDb.js';
                                  import stateDiagram from './parser/stateDiagram.jison';
                                  
                                  describe('state diagram V2, ', function () {
                                  Severity: Minor
                                  Found in packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js - About 4 hrs to fix

                                    Function adjustClustersAndEdges has 110 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export const adjustClustersAndEdges = (graph, depth) => {
                                      if (!graph || depth > 10) {
                                        log.debug('Opting out, no graph ');
                                        return;
                                      } else {
                                    Severity: Major
                                    Found in packages/mermaid/src/dagre-wrapper/mermaid-graphlib.js - About 4 hrs to fix

                                      Function drawArrow has 109 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      const drawArrow = (svg, commitA, commitB, allCommits) => {
                                        const p1 = commitPos[commitA.id]; // arrowStart
                                        const p2 = commitPos[commitB.id]; // arrowEnd
                                        const arrowNeedsRerouting = shouldRerouteArrow(commitA, commitB, p1, p2, allCommits);
                                        // log.debug('drawArrow', p1, p2, arrowNeedsRerouting, commitA.id, commitB.id);
                                      Severity: Major
                                      Found in packages/mermaid/src/diagrams/git/gitGraphRenderer.js - About 4 hrs to fix

                                        Function calculateLoopBounds has 109 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        const calculateLoopBounds = async function (messages, actors, _maxWidthPerActor, diagObj) {
                                          const loops = {};
                                          const stack = [];
                                          let current, noteModel, msgModel;
                                        
                                        
                                        Severity: Major
                                        Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts - About 4 hrs to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language