knsv/mermaid

View on GitHub

Showing 384 of 1,490 total issues

Function drawC4Shape has 184 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const drawC4Shape = function (elem, c4Shape, conf) {
  let fillColor = c4Shape.bgColor ? c4Shape.bgColor : conf[c4Shape.typeC4Shape.text + '_bg_color'];
  let strokeColor = c4Shape.borderColor
    ? c4Shape.borderColor
    : conf[c4Shape.typeC4Shape.text + '_border_color'];
Severity: Major
Found in packages/mermaid/src/diagrams/c4/svgDraw.js - About 7 hrs to fix

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

    import { arc as d3arc, select } from 'd3';
    const MAX_SECTIONS = 12;
    
    export const drawRect = function (elem, rectData) {
      const rectElem = elem.append('rect');
    Severity: Minor
    Found in packages/mermaid/src/diagrams/timeline/svgDraw.js - About 7 hrs to fix

      Function getCommits has 172 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const getCommits = () => {
        return {
          '0000001': {
            id: '0000001',
            seq: 1,
      Severity: Major
      Found in packages/mermaid/src/diagrams/git/mockDb.js - About 6 hrs to fix

        Function getArrowPoints has 169 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const getArrowPoints = (
          duplicatedDirections: Direction[],
          bbox: { width: number; height: number },
          node: any
        ) => {
        Severity: Major
        Found in packages/mermaid/src/dagre-wrapper/blockArrowHelper.ts - About 6 hrs to fix

          File erRenderer.js has 443 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';
          import { line, curveBasis, select } from 'd3';
          import { layout as dagreLayout } from 'dagre-d3-es/src/dagre/index.js';
          import { getConfig } from '../../diagram-api/diagramAPI.js';
          import { log } from '../../logger.js';
          Severity: Minor
          Found in packages/mermaid/src/diagrams/er/erRenderer.js - About 6 hrs to fix

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

            export const draw = async function (text, id, _version, diagObj) {
              log.info('Drawing flowchart');
              const { securityLevel, flowchart: conf } = getConfig();
              let sandboxElement;
              if (securityLevel === 'sandbox') {
            Severity: Major
            Found in packages/mermaid/src/diagrams/flowchart/flowRenderer.js - About 6 hrs to fix

              Function renderDoc has 162 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const renderDoc = (doc, diagram, parentId, altBkg, root, domDocument, diagObj) => {
                // Layout graph, Create a new directed graph
                const graph = new graphlib.Graph({
                  compound: true,
                  multigraph: true,
              Severity: Major
              Found in packages/mermaid/src/diagrams/state/stateRenderer.js - About 6 hrs to fix

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

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

                  File gitGraphAst.js has 431 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { log } from '../../logger.js';
                  import { random } from '../../utils.js';
                  import { getConfig } from '../../diagram-api/diagramAPI.js';
                  import common from '../common/common.js';
                  import {
                  Severity: Minor
                  Found in packages/mermaid/src/diagrams/git/gitGraphAst.js - About 6 hrs to fix

                    Function addVertices has 155 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const addVertices = async function (vert, svgId, root, doc, diagObj, parentLookupDb, graph) {
                      const svg = root.select(`[id="${svgId}"]`);
                      const nodes = svg.insert('g').attr('class', 'nodes');
                      const keys = Object.keys(vert);
                    
                    
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/flowchart/elk/flowRenderer-elk.js - About 6 hrs to fix

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

                      export const draw = function (text: string, id: string, version: string, diagObj: Diagram) {
                        //1. Fetch the configuration
                        const conf = getConfig();
                        // @ts-expect-error - wrong config?
                        const LEFT_MARGIN = conf.leftMargin ?? 50;
                      Severity: Major
                      Found in packages/mermaid/src/diagrams/timeline/timelineRenderer.ts - About 6 hrs to fix

                        Function insertMarkers has 152 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const insertMarkers = function (elem, conf) {
                          let marker;
                        
                          elem
                            .append('defs')
                        Severity: Major
                        Found in packages/mermaid/src/diagrams/er/erMarkers.js - About 6 hrs to fix

                          Function apply has 146 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const apply = function (param) {
                            if (Array.isArray(param)) {
                              param.forEach(function (item) {
                                apply(item);
                              });
                          Severity: Major
                          Found in packages/mermaid/src/diagrams/sequence/sequenceDb.js - About 5 hrs to fix

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

                            // @ts-nocheck TODO: Fix TS
                            import dayjs from 'dayjs';
                            import ganttDb from './ganttDb.js';
                            import { convert } from '../../tests/util.js';
                            
                            
                            Severity: Minor
                            Found in packages/mermaid/src/diagrams/gantt/ganttDb.spec.ts - About 5 hrs to fix

                              File baseAxis.ts has 402 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import type {
                                BoundingRect,
                                Dimension,
                                DrawableElem,
                                Point,

                                File stateDb.js has 397 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import { log } from '../../logger.js';
                                import { generateId } from '../../utils.js';
                                import common from '../common/common.js';
                                import { getConfig } from '../../diagram-api/diagramAPI.js';
                                import {
                                Severity: Minor
                                Found in packages/mermaid/src/diagrams/state/stateDb.js - About 5 hrs to fix

                                  Function addVertices has 135 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export const addVertices = async function (vert, g, svgId, root, doc, diagObj) {
                                    const svg = root.select(`[id="${svgId}"]`);
                                    const keys = Object.keys(vert);
                                  
                                    // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition
                                  Severity: Major
                                  Found in packages/mermaid/src/diagrams/flowchart/flowRenderer-v2.js - About 5 hrs to fix

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

                                    import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';
                                    import { select, curveLinear, selectAll } from 'd3';
                                    import { getConfig } from '../../diagram-api/diagramAPI.js';
                                    import utils from '../../utils.js';
                                    import { render } from '../../dagre-wrapper/index.js';
                                    Severity: Minor
                                    Found in packages/mermaid/src/diagrams/flowchart/flowRenderer-v2.js - About 5 hrs to fix

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

                                      import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';
                                      import { select, curveLinear, selectAll } from 'd3';
                                      import { getConfig } from '../../diagram-api/diagramAPI.js';
                                      import { render as Render } from 'dagre-d3-es';
                                      import { applyStyle } from 'dagre-d3-es/src/dagre-js/util.js';
                                      Severity: Minor
                                      Found in packages/mermaid/src/diagrams/flowchart/flowRenderer.js - About 5 hrs to fix

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

                                        export const addEdges = function (edges, diagObj, graph, svg) {
                                          log.info('abc78 edges = ', edges);
                                          const labelsEl = svg.insert('g').attr('class', 'edgeLabels');
                                          let linkIdCnt = {};
                                          let dir = diagObj.db.getDirection();
                                        Severity: Major
                                        Found in packages/mermaid/src/diagrams/flowchart/elk/flowRenderer-elk.js - About 5 hrs to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language