knsv/mermaid

View on GitHub

Showing 384 of 1,490 total issues

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

import { vi } from 'vitest';
import { setSiteConfig } from '../../diagram-api/diagramAPI.js';
import mermaidAPI from '../../mermaidAPI.js';
import { Diagram, getDiagramFromText } from '../../Diagram.js';
import { addDiagrams } from '../../diagram-api/diagram-orchestration.js';
Severity: Major
Found in packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js - About 4 days to fix

    File classDiagram.spec.ts has 1513 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // @ts-expect-error Jison doesn't export types
    import { parser } from './parser/classDiagram.jison';
    import classDb from './classDb.js';
    import { vi, describe, it, expect } from 'vitest';
    const spyOn = vi.spyOn;
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classDiagram.spec.ts - About 4 days to fix

      File sequenceRenderer.ts has 1360 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // @ts-nocheck TODO: fix file
      import { select } from 'd3';
      import svgDraw, { drawKatex, ACTOR_TYPE_WIDTH, drawText, fixLifeLineHeights } from './svgDraw.js';
      import { log } from '../../logger.js';
      import common, { calculateMathMLDimensions, hasKatex } from '../common/common.js';
      Severity: Major
      Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts - About 3 days to fix

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

        export const draw = function (text, id, version, diagObj) {
          const conf = getConfig().gantt;
        
          const securityLevel = getConfig().securityLevel;
          // Handle root and Document for when rendering in sandbox mode
        Severity: Major
        Found in packages/mermaid/src/diagrams/gantt/ganttRenderer.js - About 2 days to fix

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

          import { imgSnapshotTest } from '../../helpers/util.ts';
          
          describe('Git Graph diagram', () => {
            it('1: should render a simple gitgraph with commit on main branch', () => {
              imgSnapshotTest(
          Severity: Major
          Found in cypress/integration/rendering/gitGraph.spec.js - About 2 days to fix

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

            /// <reference types="Cypress" />
            
            import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
            
            context('Sequence diagram', () => {
            Severity: Major
            Found in cypress/integration/rendering/sequencediagram.spec.js - About 2 days to fix

              File nodes.js has 982 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { select } from 'd3';
              import { log } from '../logger.js';
              import { labelHelper, updateNodeBounds, insertPolygonShape } from './shapes/util.js';
              import { getConfig } from '../diagram-api/diagramAPI.js';
              import intersect from './intersect/index.js';
              Severity: Major
              Found in packages/mermaid/src/dagre-wrapper/nodes.js - About 2 days to fix

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

                import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
                
                describe('Flowchart v2', () => {
                  it('1: should render a simple flowchart', () => {
                    imgSnapshotTest(
                Severity: Major
                Found in cypress/integration/rendering/flowchart-v2.spec.js - About 2 days to fix

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

                  import gitGraphAst from './gitGraphAst.js';
                  import { parser } from './parser/gitGraph.jison';
                  
                  describe('when parsing a gitGraph', function () {
                    beforeEach(function () {
                  Severity: Major
                  Found in packages/mermaid/src/diagrams/git/gitGraphParserV2.spec.js - About 2 days to fix

                    File svgDraw.js has 875 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import common, { calculateMathMLDimensions, hasKatex, renderKatex } from '../common/common.js';
                    import * as svgDrawCommon from '../common/svgDrawCommon.js';
                    import { addFunction } from '../../interactionDb.js';
                    import { ZERO_WIDTH_SPACE, parseFontSize } from '../../utils.js';
                    import { sanitizeUrl } from '@braintree/sanitize-url';
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/sequence/svgDraw.js - About 2 days to fix

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

                      import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
                      
                      describe('Graph', () => {
                        it('1: should render a simple flowchart no htmlLabels', () => {
                          imgSnapshotTest(
                      Severity: Major
                      Found in cypress/integration/rendering/flowchart.spec.js - About 2 days to fix

                        File flowchart-elk.spec.js has 802 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
                        
                        describe.skip('Flowchart ELK', () => {
                          it('1-elk: should render a simple flowchart', () => {
                            imgSnapshotTest(
                        Severity: Major
                        Found in cypress/integration/rendering/flowchart-elk.spec.js - About 1 day to fix

                          File c4Db.js has 733 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { getConfig } from '../../diagram-api/diagramAPI.js';
                          import { sanitizeText } from '../common/common.js';
                          import {
                            setAccTitle,
                            getAccTitle,
                          Severity: Major
                          Found in packages/mermaid/src/diagrams/c4/c4Db.js - About 1 day to fix

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

                            export const draw = async function (_text: string, id: string, _version: string, diagObj: Diagram) {
                              const { securityLevel, sequence } = getConfig();
                              conf = sequence;
                              // Handle root and Document for when rendering in sandbox mode
                              let sandboxElement;
                            Severity: Major
                            Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts - About 1 day to fix

                              File flowRenderer-elk.js has 668 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import { select, line, curveLinear } from 'd3';
                              import { insertNode } from '../../../dagre-wrapper/nodes.js';
                              import insertMarkers from '../../../dagre-wrapper/markers.js';
                              import { insertEdgeLabel } from '../../../dagre-wrapper/edges.js';
                              import { findCommonAncestor } from './render-utils.js';
                              Severity: Major
                              Found in packages/mermaid/src/diagrams/flowchart/elk/flowRenderer-elk.js - About 1 day to fix

                                File ganttRenderer.js has 634 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import dayjs from 'dayjs';
                                import { log } from '../../logger.js';
                                import {
                                  select,
                                  scaleTime,
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/gantt/ganttRenderer.js - About 1 day to fix

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

                                  import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
                                  
                                  describe('Gantt diagram', () => {
                                    beforeEach(() => {
                                      cy.clock(new Date('1010-10-10').getTime());
                                  Severity: Major
                                  Found in cypress/integration/rendering/gantt.spec.js - About 1 day to fix

                                    File mermaidAPI.spec.ts has 633 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    'use strict';
                                    import { vi } from 'vitest';
                                    
                                    // -------------------------------------
                                    //  Mocks and mocking
                                    Severity: Major
                                    Found in packages/mermaid/src/mermaidAPI.spec.ts - About 1 day to fix

                                      File utils.ts has 629 lines of code (exceeds 250 allowed). Consider refactoring.
                                      Open

                                      import { sanitizeUrl } from '@braintree/sanitize-url';
                                      import type { CurveFactory } from 'd3';
                                      import {
                                        curveBasis,
                                        curveBasisClosed,
                                      Severity: Major
                                      Found in packages/mermaid/src/utils.ts - About 1 day to fix

                                        File flowDb.js has 618 lines of code (exceeds 250 allowed). Consider refactoring.
                                        Open

                                        import { select } from 'd3';
                                        import utils from '../../utils.js';
                                        import { getConfig, defaultConfig } from '../../diagram-api/diagramAPI.js';
                                        import common from '../common/common.js';
                                        import { log } from '../../logger.js';
                                        Severity: Major
                                        Found in packages/mermaid/src/diagrams/flowchart/flowDb.js - About 1 day to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language