knsv/mermaid

View on GitHub
packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts

Summary

Maintainability
F
2 wks
Test Coverage

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 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

      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

        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 buildNoteModel has 75 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const buildNoteModel = async function (msg, actors, diagObj) {
            const startx = actors[msg.from].x;
            const stopx = actors[msg.to].x;
            const shouldWrap = msg.wrap && msg.message;
          
          
          Severity: Major
          Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts - About 3 hrs to fix

            Function getMaxMessageWidthPerActor has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            async function getMaxMessageWidthPerActor(
              actors: { [id: string]: any },
              messages: any[],
              diagObj: Diagram
            ): Promise<{ [id: string]: number }> {
            Severity: Major
            Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts - About 2 hrs to fix

              Function adjustCreatedDestroyedData has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function adjustCreatedDestroyedData(
                msg,
                msgModel,
                lineStartY,
                index,
              Severity: Major
              Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts - About 2 hrs to fix

                Function buildMessageModel has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const buildMessageModel = function (msg, actors, diagObj) {
                  if (
                    ![
                      diagObj.db.LINETYPE.SOLID_OPEN,
                      diagObj.db.LINETYPE.DOTTED_OPEN,
                Severity: Major
                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts - About 2 hrs to fix

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

                  async function calculateActorMargins(
                    actors: { [id: 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 addActorRenderingData has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const addActorRenderingData = async function (
                      diagram,
                      actors,
                      createdActors,
                      actorKeys,
                    Severity: Minor
                    Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts - About 1 hr to fix

                      Function boundMessage has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      async function boundMessage(_diagram, msgModel): Promise<number> {
                        bounds.bumpVerticalPos(10);
                        const { startx, stopx, message } = msgModel;
                        const lines = common.splitBreaks(message).length;
                        const isKatexMsg = hasKatex(message);
                      Severity: Minor
                      Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts - About 1 hr to fix

                        Function drawNote has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const drawNote = async function (elem: any, noteModel: NoteModel) {
                          bounds.bumpVerticalPos(conf.boxMargin);
                          noteModel.height = conf.boxMargin;
                          noteModel.starty = bounds.getVerticalPos();
                          const rect = svgDrawCommon.getNoteRect();
                        Severity: Minor
                        Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts - About 1 hr to fix

                          Function adjustCreatedDestroyedData has 7 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            msg,
                            msgModel,
                            lineStartY,
                            index,
                            actors,
                          Severity: Major
                          Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts - About 50 mins to fix

                            Function addActorRenderingData has 7 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                              diagram,
                              actors,
                              createdActors,
                              actorKeys,
                              verticalPos,
                            Severity: Major
                            Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts - About 50 mins to fix

                              Function adjustLoopHeightForWrap has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoopFn) {
                              Severity: Minor
                              Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts - About 35 mins to fix

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                    function updateFn(type?: 'activation') {
                                      return function updateItemBounds(item) {
                                        cnt++;
                                        // The loop sequenceItems is a stack so the biggest margins in the beginning of the sequenceItems
                                        const n = _self.sequenceItems.length - cnt + 1;
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 1 day to fix
                                packages/mermaid/src/diagrams/user-journey/journeyRenderer.ts on lines 156..175

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 329.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                  function receiverAdjustment(actor, adjustment) {
                                    if (actor.x < actors[msg.from].x) {
                                      bounds.insert(
                                        msgModel.stopx - adjustment,
                                        msgModel.starty,
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 7 hrs to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 698..716

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 181.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                  function senderAdjustment(actor, adjustment) {
                                    if (actor.x < actors[msg.to].x) {
                                      bounds.insert(
                                        msgModel.startx - adjustment,
                                        msgModel.starty,
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 7 hrs to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 678..696

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 181.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                  insert: function (startx, starty, stopx, stopy) {
                                    const _startx = common.getMin(startx, stopx);
                                    const _stopx = common.getMax(startx, stopx);
                                    const _starty = common.getMin(starty, stopy);
                                    const _stopy = common.getMax(starty, stopy);
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 7 hrs to fix
                                packages/mermaid/src/diagrams/user-journey/journeyRenderer.ts on lines 179..191

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 180.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                    ![
                                      diagObj.db.LINETYPE.SOLID_OPEN,
                                      diagObj.db.LINETYPE.DOTTED_OPEN,
                                      diagObj.db.LINETYPE.SOLID,
                                      diagObj.db.LINETYPE.DOTTED,
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 4 hrs to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 1024..1033

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 118.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                      [
                                        diagObj.db.LINETYPE.SOLID_OPEN,
                                        diagObj.db.LINETYPE.DOTTED_OPEN,
                                        diagObj.db.LINETYPE.SOLID,
                                        diagObj.db.LINETYPE.DOTTED,
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 4 hrs to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 1411..1420

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 118.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                  if (conf.arrowMarkerAbsolute) {
                                    url =
                                      window.location.protocol +
                                      '//' +
                                      window.location.host +
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 2 hrs to fix
                                packages/mermaid/src/diagrams/common/common.ts on lines 154..163

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 91.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 6 locations. Consider refactoring.
                                Open

                                      case diagObj.db.LINETYPE.PAR_END:
                                        loopModel = bounds.endLoop();
                                        await svgDraw.drawLoop(diagram, loopModel, 'par', conf);
                                        bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
                                        bounds.models.addLoop(loopModel);
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 5 other locations - About 2 hrs to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 869..874
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 895..900
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 919..924
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 978..983
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 993..998

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 88.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 6 locations. Consider refactoring.
                                Open

                                      case diagObj.db.LINETYPE.OPT_END:
                                        loopModel = bounds.endLoop();
                                        await svgDraw.drawLoop(diagram, loopModel, 'opt', conf);
                                        bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
                                        bounds.models.addLoop(loopModel);
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 5 other locations - About 2 hrs to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 869..874
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 919..924
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 945..950
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 978..983
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 993..998

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 88.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 6 locations. Consider refactoring.
                                Open

                                      case diagObj.db.LINETYPE.CRITICAL_END:
                                        loopModel = bounds.endLoop();
                                        await svgDraw.drawLoop(diagram, loopModel, 'critical', conf);
                                        bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
                                        bounds.models.addLoop(loopModel);
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 5 other locations - About 2 hrs to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 869..874
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 895..900
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 919..924
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 945..950
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 993..998

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 88.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 6 locations. Consider refactoring.
                                Open

                                      case diagObj.db.LINETYPE.BREAK_END:
                                        loopModel = bounds.endLoop();
                                        await svgDraw.drawLoop(diagram, loopModel, 'break', conf);
                                        bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
                                        bounds.models.addLoop(loopModel);
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 5 other locations - About 2 hrs to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 869..874
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 895..900
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 919..924
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 945..950
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 978..983

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 88.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 6 locations. Consider refactoring.
                                Open

                                      case diagObj.db.LINETYPE.ALT_END:
                                        loopModel = bounds.endLoop();
                                        await svgDraw.drawLoop(diagram, loopModel, 'alt', conf);
                                        bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
                                        bounds.models.addLoop(loopModel);
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 5 other locations - About 2 hrs to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 869..874
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 895..900
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 945..950
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 978..983
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 993..998

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 88.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 6 locations. Consider refactoring.
                                Open

                                      case diagObj.db.LINETYPE.LOOP_END:
                                        loopModel = bounds.endLoop();
                                        await svgDraw.drawLoop(diagram, loopModel, 'loop', conf);
                                        bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
                                        bounds.models.addLoop(loopModel);
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 5 other locations - About 2 hrs to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 895..900
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 919..924
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 945..950
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 978..983
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 993..998

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 88.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Identical blocks of code found in 2 locations. Consider refactoring.
                                Open

                                  updateVal: function (obj, key, val, fun) {
                                    if (obj[key] === undefined) {
                                      obj[key] = val;
                                    } else {
                                      obj[key] = fun(val, obj[key]);
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 1 hr to fix
                                packages/mermaid/src/diagrams/user-journey/journeyRenderer.ts on lines 143..149

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 64.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Identical blocks of code found in 2 locations. Consider refactoring.
                                Open

                                    noteModel.width = shouldWrap
                                      ? common.getMax(conf.width, textDimensions.width + 2 * conf.noteMargin)
                                      : common.getMax(
                                          actors[msg.from].width / 2 + actors[msg.to].width / 2,
                                          textDimensions.width + 2 * conf.noteMargin
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 1 hr to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 1353..1358

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 63.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Identical blocks of code found in 2 locations. Consider refactoring.
                                Open

                                    noteModel.width = shouldWrap
                                      ? common.getMax(conf.width, textDimensions.width)
                                      : common.getMax(
                                          actors[msg.from].width / 2 + actors[msg.to].width / 2,
                                          textDimensions.width + 2 * conf.noteMargin
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 1 hr to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 1361..1366

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 63.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 3 locations. Consider refactoring.
                                Open

                                        Math.max.apply(
                                          null,
                                          this.actors.length === 0 ? [0] : this.actors.map((actor) => actor.height || 0)
                                        ) +
                                        (this.loops.length === 0
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 2 other locations - About 1 hr to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 28..37
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 28..40

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 61.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                  const right = activations.reduce(function (acc, activation) {
                                    return common.getMax(acc, activation.stopx);
                                  }, actorObj.x + actorObj.width / 2 + 1);
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 1 hr to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 630..632

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 59.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                  const left = activations.reduce(function (acc, activation) {
                                    return common.getMin(acc, activation.startx);
                                  }, actorObj.x + actorObj.width / 2 - 1);
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 1 hr to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 633..635

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 59.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                            current.from = common.getMin(
                                              from.x - msgModel.width / 2,
                                              from.x - from.width / 2,
                                              current.from
                                            );
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 1 hr to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 1589..1593

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 57.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                            current.to = common.getMax(
                                              to.x + msgModel.width / 2,
                                              to.x + from.width / 2,
                                              current.to
                                            );
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 1 hr to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 1584..1588

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 57.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 5 locations. Consider refactoring.
                                Open

                                      case diagObj.db.LINETYPE.LOOP_START:
                                        adjustLoopHeightForWrap(
                                          loopWidths,
                                          msg,
                                          conf.boxMargin,
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 4 other locations - About 1 hr to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 886..894
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 901..909
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 960..968
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 984..992

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 56.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 5 locations. Consider refactoring.
                                Open

                                      case diagObj.db.LINETYPE.ALT_START:
                                        adjustLoopHeightForWrap(
                                          loopWidths,
                                          msg,
                                          conf.boxMargin,
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 4 other locations - About 1 hr to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 860..868
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 886..894
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 960..968
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 984..992

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 56.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 5 locations. Consider refactoring.
                                Open

                                      case diagObj.db.LINETYPE.CRITICAL_START:
                                        adjustLoopHeightForWrap(
                                          loopWidths,
                                          msg,
                                          conf.boxMargin,
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 4 other locations - About 1 hr to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 860..868
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 886..894
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 901..909
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 984..992

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 56.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 5 locations. Consider refactoring.
                                Open

                                      case diagObj.db.LINETYPE.BREAK_START:
                                        adjustLoopHeightForWrap(
                                          loopWidths,
                                          msg,
                                          conf.boxMargin,
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 4 other locations - About 1 hr to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 860..868
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 886..894
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 901..909
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 960..968

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 56.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 5 locations. Consider refactoring.
                                Open

                                      case diagObj.db.LINETYPE.OPT_START:
                                        adjustLoopHeightForWrap(
                                          loopWidths,
                                          msg,
                                          conf.boxMargin,
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 4 other locations - About 1 hr to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 860..868
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 901..909
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 960..968
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 984..992

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 56.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 3 locations. Consider refactoring.
                                Open

                                      case diagObj.db.LINETYPE.ALT_ELSE:
                                        adjustLoopHeightForWrap(
                                          loopWidths,
                                          msg,
                                          conf.boxMargin + conf.boxTextMargin,
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 2 other locations - About 1 hr to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 936..944
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 969..977

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 56.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 3 locations. Consider refactoring.
                                Open

                                      case diagObj.db.LINETYPE.PAR_AND:
                                        adjustLoopHeightForWrap(
                                          loopWidths,
                                          msg,
                                          conf.boxMargin + conf.boxTextMargin,
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 2 other locations - About 1 hr to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 910..918
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 969..977

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 56.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 3 locations. Consider refactoring.
                                Open

                                      case diagObj.db.LINETYPE.CRITICAL_OPTION:
                                        adjustLoopHeightForWrap(
                                          loopWidths,
                                          msg,
                                          conf.boxMargin + conf.boxTextMargin,
                                Severity: Major
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 2 other locations - About 1 hr to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 910..918
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 936..944

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 56.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                        current.width =
                                          common.getMax(current.width, Math.abs(current.from - current.to)) - conf.labelBoxWidth;
                                Severity: Minor
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 50 mins to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 1594..1596

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 52.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                            current.width =
                                              common.getMax(current.width, Math.abs(current.to - current.from)) -
                                              conf.labelBoxWidth;
                                Severity: Minor
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 50 mins to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 1572..1573

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 52.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                        if (actor.prevActor) {
                                          maxMessageWidthPerActor[actor.prevActor] = common.getMax(
                                            maxMessageWidthPerActor[actor.prevActor] || 0,
                                            messageWidth / 2
                                          );
                                Severity: Minor
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 50 mins to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 1215..1220

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 51.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                        if (actor.nextActor) {
                                          maxMessageWidthPerActor[msg.from] = common.getMax(
                                            maxMessageWidthPerActor[msg.from] || 0,
                                            messageWidth / 2
                                          );
                                Severity: Minor
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 50 mins to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 1208..1213

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 51.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                  if (shouldWrap) {
                                    noteModel.message = utils.wrapLabel(
                                      msg.message,
                                      noteModel.width - 2 * conf.wrapPadding,
                                      noteFont(conf)
                                Severity: Minor
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 40 mins to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 1262..1268

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 49.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                    if (actor.wrap) {
                                      actor.description = utils.wrapLabel(
                                        actor.description,
                                        conf.width - 2 * conf.wrapPadding,
                                        actorFont(conf)
                                Severity: Minor
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 40 mins to fix
                                packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 1396..1402

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 49.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                  const diagram =
                                    securityLevel === 'sandbox' ? root.select(`[id="${id}"]`) : select(`[id="${id}"]`);
                                Severity: Minor
                                Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 35 mins to fix
                                packages/mermaid/src/diagrams/sankey/sankeyRenderer.ts on lines 60..60

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 46.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                There are no issues that match your filters.

                                Category
                                Status