knsv/mermaid

View on GitHub

Showing 429 of 1,682 total issues

Function addComponent has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

    import { imgSnapshotTest } from '../../helpers/util.ts';
    
    describe('Quadrant Chart', () => {
      it('should render if only chart type is provided', () => {
        imgSnapshotTest(
    Severity: Minor
    Found in cypress/integration/rendering/quadrantChart.spec.js - About 2 hrs to fix

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

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

        Function calculateActorMargins has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        async function calculateActorMargins(
          actors: Map<string, any>,
          actorToMessageWidth: Awaited<ReturnType<typeof getMaxMessageWidthPerActor>>,
          boxes
        ) {
        Severity: Major
        Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts - About 2 hrs to fix

          Function drawTask has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const drawTask = function (elem, task, conf) {
            const center = task.x + conf.width / 2;
            const g = elem.append('g');
            taskCount++;
            const maxHeight = 300 + 5 * 30;
          Severity: Major
          Found in packages/mermaid/src/diagrams/user-journey/svgDraw.js - About 2 hrs to fix

            Function cylinder has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const cylinder = async (parent: SVGAElement, node: Node) => {
              const { labelStyles, nodeStyles } = styles2String(node);
              node.labelStyle = labelStyles;
              const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
              const w = bbox.width + node.padding;

              Function cylinder has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function cylinder(parent, bbox, node) {
                const w = bbox.width;
                const rx = w / 2;
                const ry = rx / (2.5 + w / 50);
                const h = bbox.height + ry;
              Severity: Major
              Found in packages/mermaid/src/diagrams/flowchart/flowChartShapes.js - About 2 hrs to fix

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

                export const draw = (_text: string, id: string, version: string) => {
                  log.debug('rendering svg for syntax error\n');
                  const svg: SVG = selectSvgElement(id);
                  const g: SVGGroup = svg.append('g');
                
                
                Severity: Major
                Found in packages/mermaid/src/diagrams/error/errorRenderer.ts - About 2 hrs to fix

                  Function calculateHorizontalSpace has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private calculateHorizontalSpace() {
                      let availableWidth = this.chartConfig.width;
                      let availableHeight = this.chartConfig.height;
                      let titleYEnd = 0;
                      let plotX = 0;
                  Severity: Major
                  Found in packages/mermaid/src/diagrams/xychart/chartBuilder/orchestrator.ts - About 2 hrs to fix

                    Function roundedWithTitle has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const roundedWithTitle = (parent, node) => {
                      const siteConfig = getConfig();
                    
                      // Add outer g element
                      const shapeSvg = parent.insert('g').attr('class', node.classes).attr('id', node.id);
                    Severity: Major
                    Found in packages/mermaid/src/dagre-wrapper/clusters.js - About 2 hrs to fix

                      Function drawDescrState has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const drawDescrState = (g, stateDef) => {
                        const addTspan = function (textEl, txt, isFirst) {
                          const tSpan = textEl
                            .append('tspan')
                            .attr('x', 2 * getConfig().state.padding)
                      Severity: Major
                      Found in packages/mermaid/src/diagrams/state/shapes.js - About 2 hrs to fix

                        Function addDeploymentNode has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const addDeploymentNode = function (
                          nodeType,
                          alias,
                          label,
                          type,
                        Severity: Major
                        Found in packages/mermaid/src/diagrams/c4/c4Db.js - About 2 hrs to fix

                          Function getStyles has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const getStyles = (
                            type: string,
                            userStyles: string,
                            options: {
                              fontFamily: string;
                          Severity: Major
                          Found in packages/mermaid/src/styles.ts - About 2 hrs to fix

                            Function intersection has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const intersection = (node, outsidePoint, insidePoint) => {
                              log.debug(`intersection calc abc89:
                              outsidePoint: ${JSON.stringify(outsidePoint)}
                              insidePoint : ${JSON.stringify(insidePoint)}
                              node        : x:${node.x} y:${node.y} w:${node.width} h:${node.height}`);
                            Severity: Major
                            Found in packages/mermaid/src/rendering-util/rendering-elements/edges.js - About 2 hrs to fix

                              Function intersection has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const intersection = (node, outsidePoint, insidePoint) => {
                                log.debug(`intersection calc abc89:
                                outsidePoint: ${JSON.stringify(outsidePoint)}
                                insidePoint : ${JSON.stringify(insidePoint)}
                                node        : x:${node.x} y:${node.y} w:${node.width} h:${node.height}`);
                              Severity: Major
                              Found in packages/mermaid/src/dagre-wrapper/edges.js - About 2 hrs to fix

                                Function setupDoc has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const setupDoc = (parentParsedItem, doc, diagramStates, nodes, edges, altFlag, look, classes) => {
                                  // graphItemCount = 0;
                                  log.trace('items', doc);
                                  doc.forEach((item) => {
                                    switch (item.stmt) {
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/state/dataFetcher.js - About 2 hrs to fix

                                  Function calculateVerticalSpace has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    private calculateVerticalSpace() {
                                      let availableWidth = this.chartConfig.width;
                                      let availableHeight = this.chartConfig.height;
                                      let plotX = 0;
                                      let plotY = 0;
                                  Severity: Major
                                  Found in packages/mermaid/src/diagrams/xychart/chartBuilder/orchestrator.ts - About 2 hrs to fix

                                    Function getIntersectPoint has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    let getIntersectPoint = function (fromNode, endPoint) {
                                      let x1 = fromNode.x;
                                    
                                      let y1 = fromNode.y;
                                    
                                    
                                    Severity: Major
                                    Found in packages/mermaid/src/diagrams/c4/c4Renderer.js - About 2 hrs to fix

                                      Function getLineFunctionsWithOffset has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      export const getLineFunctionsWithOffset = (
                                        edge: Pick<EdgeData, 'arrowTypeStart' | 'arrowTypeEnd'>
                                      ) => {
                                        return {
                                          x: function (
                                      Severity: Major
                                      Found in packages/mermaid/src/utils/lineWithOffset.ts - About 2 hrs to fix

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

                                        export const drawTasks = function (diagram, tasks, verticalPos) {
                                          const conf = getConfig().journey;
                                          let lastSection = '';
                                          const sectionVHeight = conf.height * 2 + conf.diagramMarginY;
                                          const taskPos = verticalPos + sectionVHeight;
                                        Severity: Major
                                        Found in packages/mermaid/src/diagrams/user-journey/journeyRenderer.ts - About 2 hrs to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language