knsv/mermaid

View on GitHub
packages/mermaid/src/diagrams/c4/svgDraw.js

Summary

Maintainability
F
1 wk
Test Coverage

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

import common from '../common/common.js';
import * as svgDrawCommon from '../common/svgDrawCommon.js';
import { sanitizeUrl } from '@braintree/sanitize-url';

export const drawRect = function (elem, rectData) {
Severity: Major
Found in packages/mermaid/src/diagrams/c4/svgDraw.js - About 1 day to fix

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

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

      Function drawRels has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const drawRels = (elem, rels, conf) => {
        const relsElem = elem.append('g');
        let i = 0;
        for (let rel of rels) {
          let textColor = rel.textColor ? rel.textColor : '#444444';
      Severity: Major
      Found in packages/mermaid/src/diagrams/c4/svgDraw.js - About 3 hrs to fix

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

        const drawBoundary = function (elem, boundary, conf) {
          const boundaryElem = elem.append('g');
        
          let fillColor = boundary.bgColor ? boundary.bgColor : 'none';
          let strokeColor = boundary.borderColor ? boundary.borderColor : '#444444';
        Severity: Major
        Found in packages/mermaid/src/diagrams/c4/svgDraw.js - About 2 hrs to fix

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

          const _drawTextCandidateFunc = (function () {
            /**
             * @param {any} content
             * @param {any} g
             * @param {any} x
          Severity: Major
          Found in packages/mermaid/src/diagrams/c4/svgDraw.js - About 2 hrs to fix

            Function byFo has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              function byFo(content, g, x, y, width, height, textAttrs, conf) {
            Severity: Major
            Found in packages/mermaid/src/diagrams/c4/svgDraw.js - About 1 hr to fix

              Function byTspan has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                function byTspan(content, g, x, y, width, height, textAttrs, conf) {
              Severity: Major
              Found in packages/mermaid/src/diagrams/c4/svgDraw.js - About 1 hr to fix

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

                  function byText(content, g, x, y, width, height, textAttrs) {
                Severity: Major
                Found in packages/mermaid/src/diagrams/c4/svgDraw.js - About 50 mins to fix

                  Function drawImage has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  export const drawImage = function (elem, width, height, x, y, link) {
                  Severity: Minor
                  Found in packages/mermaid/src/diagrams/c4/svgDraw.js - About 45 mins to fix

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

                      function byFo(content, g, x, y, width, height, textAttrs, conf) {
                        const s = g.append('switch');
                        const f = s
                          .append('foreignObject')
                          .attr('x', x)
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 2 other locations - About 1 day to fix
                    packages/mermaid/src/diagrams/sequence/svgDraw.js on lines 911..935
                    packages/mermaid/src/diagrams/sequence/svgDraw.js on lines 1057..1081

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

                    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

                    export const insertDynamicNumber = function (elem) {
                      elem
                        .append('defs')
                        .append('marker')
                        .attr('id', 'sequencenumber')
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 1 other location - About 4 hrs to fix
                    packages/mermaid/src/diagrams/sequence/svgDraw.js on lines 766..781

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

                    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

                    export const insertArrowHead = function (elem) {
                      elem
                        .append('defs')
                        .append('marker')
                        .attr('id', 'arrowhead')
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 2 other locations - About 4 hrs to fix
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 465..478
                    packages/mermaid/src/diagrams/sequence/svgDraw.js on lines 727..740

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

                    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

                    export const insertArrowEnd = function (elem) {
                      elem
                        .append('defs')
                        .append('marker')
                        .attr('id', 'arrowend')
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 2 other locations - About 4 hrs to fix
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 450..463
                    packages/mermaid/src/diagrams/sequence/svgDraw.js on lines 727..740

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

                    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

                    export const insertArrowFilledHead = function (elem) {
                      elem
                        .append('defs')
                        .append('marker')
                        .attr('id', 'filled-head')
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 1 other location - About 3 hrs to fix
                    packages/mermaid/src/diagrams/sequence/svgDraw.js on lines 747..759

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

                    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

                      function byText(content, g, x, y, width, height, textAttrs) {
                        const text = g
                          .append('text')
                          .attr('x', x + width / 2)
                          .attr('y', y + height / 2 + 5)
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 1 other location - About 3 hrs to fix
                    packages/mermaid/src/diagrams/sequence/svgDraw.js on lines 850..858

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

                    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

                    export const insertClockIcon = function (elem) {
                      elem
                        .append('defs')
                        .append('symbol')
                        .attr('id', 'clock')
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 1 other location - About 2 hrs to fix
                    packages/mermaid/src/diagrams/sequence/svgDraw.js on lines 707..720

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

                    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 4 locations. Consider refactoring.
                    Open

                    export const insertDatabaseIcon = function (elem) {
                      elem
                        .append('defs')
                        .append('symbol')
                        .attr('id', 'database')
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 3 other locations - About 2 hrs to fix
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 415..428
                    packages/mermaid/src/diagrams/sequence/svgDraw.js on lines 677..690
                    packages/mermaid/src/diagrams/sequence/svgDraw.js on lines 692..705

                    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 4 locations. Consider refactoring.
                    Open

                    export const insertComputerIcon = function (elem) {
                      elem
                        .append('defs')
                        .append('symbol')
                        .attr('id', 'computer')
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 3 other locations - About 2 hrs to fix
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 400..413
                    packages/mermaid/src/diagrams/sequence/svgDraw.js on lines 677..690
                    packages/mermaid/src/diagrams/sequence/svgDraw.js on lines 692..705

                    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 2 locations. Consider refactoring.
                    Open

                      const marker = defs
                        .append('marker')
                        .attr('id', 'crosshead')
                        .attr('markerWidth', 15)
                        .attr('markerHeight', 8)
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 1 other location - About 1 hr to fix
                    packages/mermaid/src/diagrams/sequence/svgDraw.js on lines 790..797

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

                    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 (c4Shape.techn && c4Shape.techn?.text !== '') {
                        _drawTextCandidateFunc(conf)(
                          c4Shape.techn.text,
                          c4ShapeElem,
                          c4Shape.x,
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 1 other location - About 1 hr to fix
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 368..379

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

                    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

                      } else if (c4Shape.type && c4Shape.type.text !== '') {
                        _drawTextCandidateFunc(conf)(
                          c4Shape.type.text,
                          c4ShapeElem,
                          c4Shape.x,
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 1 other location - About 1 hr to fix
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 357..379

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

                    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.min(rel.startPoint.x, rel.endPoint.x) +
                            Math.abs(rel.endPoint.x - rel.startPoint.x) / 2 +
                            offsetX,
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 2 other locations - About 1 hr to fix
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 82..84
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 96..98

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

                    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.min(rel.startPoint.y, rel.endPoint.y) +
                            Math.abs(rel.endPoint.y - rel.startPoint.y) / 2 +
                            offsetY,
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 2 other locations - About 1 hr to fix
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 79..81
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 96..98

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

                    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.min(rel.startPoint.x, rel.endPoint.x) +
                              Math.abs(rel.endPoint.x - rel.startPoint.x) / 2 +
                              offsetX,
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 2 other locations - About 1 hr to fix
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 79..81
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 82..84

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

                    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

                        _drawTextCandidateFunc(conf)(
                          boundary.type.text,
                          boundaryElem,
                          boundary.x,
                          boundary.y + boundary.type.Y,
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 1 other location - About 1 hr to fix
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 182..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 60.

                    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

                        _drawTextCandidateFunc(conf)(
                          boundary.descr.text,
                          boundaryElem,
                          boundary.x,
                          boundary.y + boundary.descr.Y,
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 1 other location - About 1 hr to fix
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 165..174

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

                    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

                      marker
                        .append('path')
                        .attr('fill', 'none')
                        .attr('stroke', '#000000')
                        .style('stroke-dasharray', '0, 0')
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 2 other locations - About 1 hr to fix
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 538..544
                    packages/mermaid/src/diagrams/sequence/svgDraw.js on lines 799..805

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

                    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

                      marker
                        .append('path')
                        .attr('fill', 'black')
                        .attr('stroke', '#000000')
                        .style('stroke-dasharray', '0, 0')
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 2 other locations - About 1 hr to fix
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 547..553
                    packages/mermaid/src/diagrams/sequence/svgDraw.js on lines 799..805

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

                    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

                      _drawTextCandidateFunc(conf)(
                        c4Shape.label.text,
                        c4ShapeElem,
                        c4Shape.x,
                        c4Shape.y + c4Shape.label.Y,
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 1 other location - About 1 hr to fix
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 385..394

                    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

                        _drawTextCandidateFunc(conf)(
                          c4Shape.descr.text,
                          c4ShapeElem,
                          c4Shape.x,
                          c4Shape.y + c4Shape.descr.Y,
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 1 other location - About 1 hr to fix
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 342..351

                    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 getC4ShapeFont = (cnf, typeC4Shape) => {
                      return {
                        fontFamily: cnf[typeC4Shape + 'FontFamily'],
                        fontSize: cnf[typeC4Shape + 'FontSize'],
                        fontWeight: cnf[typeC4Shape + 'FontWeight'],
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 1 other location - About 1 hr to fix
                    packages/mermaid/src/diagrams/c4/c4Renderer.js on lines 133..139

                    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

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

                      function _setTextAttrs(toText, fromTextAttrsDict) {
                        for (const key in fromTextAttrsDict) {
                          if (fromTextAttrsDict.hasOwnProperty(key)) {
                            toText.attr(key, fromTextAttrsDict[key]);
                          }
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 2 other locations - About 1 hr to fix
                    packages/mermaid/src/diagrams/sequence/svgDraw.js on lines 976..982
                    packages/mermaid/src/diagrams/sequence/svgDraw.js on lines 1087..1093

                    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

                          const text = g
                            .append('text')
                            .attr('x', x + width / 2)
                            .attr('y', y)
                            .style('text-anchor', 'middle')
                    Severity: Minor
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 1 other location - About 40 mins to fix
                    packages/mermaid/src/diagrams/sequence/svgDraw.js on lines 878..883

                    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

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

                          if (rel.type === 'birel' || rel.type === 'rel_b') {
                            line.attr('marker-start', 'url(' + url + '#arrowend)');
                          }
                    Severity: Minor
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 1 other location - About 35 mins to fix
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 70..72

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

                    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

                          if (rel.type === 'birel' || rel.type === 'rel_b') {
                            line.attr('marker-start', 'url(' + url + '#arrowend)');
                          }
                    Severity: Minor
                    Found in packages/mermaid/src/diagrams/c4/svgDraw.js and 1 other location - About 35 mins to fix
                    packages/mermaid/src/diagrams/c4/svgDraw.js on lines 42..44

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

                    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