knsv/mermaid

View on GitHub

Showing 384 of 1,490 total issues

Function drawMessage has 107 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const drawMessage = async function (diagram, msgModel, lineStartY: number, diagObj: Diagram) {
  const { startx, stopx, starty, message, type, sequenceIndex, sequenceVisible } = msgModel;
  const textDims = utils.calculateTextDimensions(message, messageFont(conf));
  const textObj = svgDrawCommon.getTextObj();
  textObj.x = startx;
Severity: Major
Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts - About 4 hrs to fix

    Function drawClass has 106 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const drawClass = function (elem, classDef, conf, diagObj) {
      log.debug('Rendering class ', classDef, conf);
    
      const id = classDef.id;
      const classInfo = {
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/svgDraw.js - About 4 hrs to fix

      Function addVertices has 106 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}"]`) : root.select(`[id="${svgId}"]`);
        const doc = !_doc ? document : _doc;
        const keys = Object.keys(vert);
      
      
      Severity: Major
      Found in packages/mermaid/src/diagrams/flowchart/flowRenderer.js - About 4 hrs to fix

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

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

          Function drawNode has 103 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const drawNode = function (
            db: MindmapDB,
            elem: D3Element,
            node: FilledMindMapNode,
            fullSection: number,
          Severity: Major
          Found in packages/mermaid/src/diagrams/mindmap/svgDraw.ts - About 4 hrs to fix

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

            export const draw = async function (text, id, _version, diagObj) {
              // Add temporary render element
              diagObj.db.clear();
              nodeDb = {};
              portPos = {};
            Severity: Major
            Found in packages/mermaid/src/diagrams/flowchart/elk/flowRenderer-elk.js - About 4 hrs to fix

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

              export const draw = function (text, id, _version, diagObj) {
                const conf = getConfig().class;
                idCache = {};
              
                log.info('Rendering diagram ' + text);
              Severity: Major
              Found in packages/mermaid/src/diagrams/class/classRenderer.js - About 4 hrs to fix

                Function getNodeFromBlock has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function getNodeFromBlock(block: Block, db: BlockDB, positioned = false) {
                  const vertex = block;
                
                  let classStr = 'default';
                  if ((vertex?.classes?.length || 0) > 0) {
                Severity: Major
                Found in packages/mermaid/src/diagrams/block/renderHelpers.ts - About 4 hrs to fix

                  Function drawInsideBoundary has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function drawInsideBoundary(
                    diagram,
                    parentBoundaryAlias,
                    parentBounds,
                    currentBoundaries,
                  Severity: Major
                  Found in packages/mermaid/src/diagrams/c4/c4Renderer.js - About 3 hrs to fix

                    Function drawRelationshipFromLayout has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const drawRelationshipFromLayout = function (svg, rel, g, insert, diagObj) {
                      relCnt++;
                    
                      // Find the edge relating to this relationship
                      const edge = g.edge(
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/er/erRenderer.js - About 3 hrs to fix

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

                      /**
                       * This is the API to be used when optionally handling the integration with the web page, instead of
                       * using the default integration provided by mermaid.js.
                       *
                       * The core of this api is the [**render**](Setup.md?id=render) function which, given a graph
                      Severity: Minor
                      Found in packages/mermaid/src/mermaidAPI.ts - About 3 hrs to fix

                        Function extractor has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const extractor = (graph, depth) => {
                          log.warn('extractor - ', depth, graphlibJson.write(graph), graph.children('D'));
                          if (depth > 10) {
                            log.error('Bailing out');
                            return;
                        Severity: Major
                        Found in packages/mermaid/src/dagre-wrapper/mermaid-graphlib.js - About 3 hrs to fix

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

                          // @ts-expect-error No types available for JISON
                          import { parser as mindmap } from './parser/mindmap.jison';
                          import mindmapDB from './mindmapDb.js';
                          // Todo fix utils functions for tests
                          import { setLogLevel } from '../../diagram-api/diagramAPI.js';
                          Severity: Minor
                          Found in packages/mermaid/src/diagrams/mindmap/mindmap.spec.ts - About 3 hrs to fix

                            Function svgDrawLineForCommits has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function svgDrawLineForCommits(svg, fromId, toId, direction, color) {
                              logger.debug('svgDrawLineForCommits: ', fromId, toId);
                              const fromBbox = getElementCoords(svg.select('#node-' + fromId + ' circle'));
                              const toBbox = getElementCoords(svg.select('#node-' + toId + ' circle'));
                              switch (direction) {
                            Severity: Major
                            Found in packages/mermaid/src/diagrams/git/gitGraphRenderer-old.js - About 3 hrs to fix

                              File theme-default.js has 323 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import { invert, lighten, rgba, adjust, darken, isDark } from 'khroma';
                              import { mkBorder } from './theme-helpers.js';
                              import {
                                oldAttributeBackgroundColorEven,
                                oldAttributeBackgroundColorOdd,
                              Severity: Minor
                              Found in packages/mermaid/src/themes/theme-default.js - About 3 hrs to fix

                                Function render has 93 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const render = async function (
                                  id: string,
                                  text: string,
                                  svgContainingElement?: Element
                                ): Promise<RenderResult> {
                                Severity: Major
                                Found in packages/mermaid/src/mermaidAPI.ts - About 3 hrs to fix

                                  Function merge has 93 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export const merge = function (otherBranch, custom_id, override_type, custom_tag) {
                                    otherBranch = common.sanitizeText(otherBranch, getConfig());
                                    custom_id = common.sanitizeText(custom_id, getConfig());
                                  
                                    const currentCommit = commits[branches[curBranch]];
                                  Severity: Major
                                  Found in packages/mermaid/src/diagrams/git/gitGraphAst.js - About 3 hrs to fix

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

                                    import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
                                    
                                    describe('XY Chart', () => {
                                      it('should render the simplest possible chart', () => {
                                        imgSnapshotTest(
                                    Severity: Minor
                                    Found in cypress/integration/rendering/xyChart.spec.js - About 3 hrs to fix

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

                                      const insertMarkers = function (elem) {
                                        elem
                                          .append('defs')
                                          .append('marker')
                                          .attr('id', 'extensionStart')
                                      Severity: Major
                                      Found in packages/mermaid/src/diagrams/class/classRenderer.js - About 3 hrs to fix

                                        Function constructor has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                          constructor() {
                                            /* Base variables */
                                            this.background = '#f4f4f4';
                                            this.primaryColor = '#ECECFF';
                                        
                                        
                                        Severity: Major
                                        Found in packages/mermaid/src/themes/theme-default.js - About 3 hrs to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language