knsv/mermaid

View on GitHub
packages/mermaid/src/diagrams/user-journey/svgDraw.js

Summary

Maintainability
F
2 wks
Test Coverage

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

import { arc as d3arc } from 'd3';
import * as svgDrawCommon from '../common/svgDrawCommon.js';

export const drawRect = function (elem, rectData) {
  return svgDrawCommon.drawRect(elem, rectData);
Severity: Minor
Found in packages/mermaid/src/diagrams/user-journey/svgDraw.js - About 3 hrs to fix

    Function drawFace has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const drawFace = function (element, faceData) {
      const radius = 15;
      const circleElement = element
        .append('circle')
        .attr('cx', faceData.cx)
    Severity: Major
    Found in packages/mermaid/src/diagrams/user-journey/svgDraw.js - About 2 hrs to fix

      Function _drawTextCandidateFunc has 69 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/user-journey/svgDraw.js - About 2 hrs to fix

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

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

          Function drawLabel has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const drawLabel = function (elem, txtObject) {
            /**
             * @param {any} x
             * @param {any} y
             * @param {any} width
          Severity: Minor
          Found in packages/mermaid/src/diagrams/user-journey/svgDraw.js - About 1 hr to fix

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

              function byTspan(content, g, x, y, width, height, textAttrs, conf, colour) {
            Severity: Major
            Found in packages/mermaid/src/diagrams/user-journey/svgDraw.js - About 1 hr 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/user-journey/svgDraw.js - About 1 hr to fix

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

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

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

                    function genPoints(x, y, width, height, cut) {
                  Severity: Minor
                  Found in packages/mermaid/src/diagrams/user-journey/svgDraw.js - About 35 mins to fix

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

                    export const drawFace = function (element, faceData) {
                      const radius = 15;
                      const circleElement = element
                        .append('circle')
                        .attr('cx', faceData.cx)
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/user-journey/svgDraw.js and 1 other location - About 4 days to fix
                    packages/mermaid/src/diagrams/timeline/svgDraw.js on lines 22..109

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

                    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 _drawTextCandidateFunc = (function () {
                      /**
                       * @param {any} content
                       * @param {any} g
                       * @param {any} x
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/user-journey/svgDraw.js and 1 other location - About 4 days to fix
                    packages/mermaid/src/diagrams/timeline/svgDraw.js on lines 336..452

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

                    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 drawLabel = function (elem, txtObject) {
                      /**
                       * @param {any} x
                       * @param {any} y
                       * @param {any} width
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/user-journey/svgDraw.js and 1 other location - About 1 day to fix
                    packages/mermaid/src/diagrams/timeline/svgDraw.js on lines 153..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 256.

                    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 drawCircle = function (element, circleData) {
                      const circleElement = element.append('circle');
                      circleElement.attr('cx', circleData.cx);
                      circleElement.attr('cy', circleData.cy);
                      circleElement.attr('class', 'actor-' + circleData.pos);
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/user-journey/svgDraw.js and 1 other location - About 1 day to fix
                    packages/mermaid/src/diagrams/timeline/svgDraw.js on lines 111..129

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

                    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

                    const initGraphics = function (graphics) {
                      graphics
                        .append('defs')
                        .append('marker')
                        .attr('id', 'arrowhead')
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/user-journey/svgDraw.js and 1 other location - About 3 hrs to fix
                    packages/mermaid/src/diagrams/timeline/svgDraw.js on lines 454..466

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

                    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

                      g.append('line')
                        .attr('id', 'task' + taskCount)
                        .attr('x1', center)
                        .attr('y1', task.y)
                        .attr('x2', center)
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/user-journey/svgDraw.js and 1 other location - About 3 hrs to fix
                    packages/mermaid/src/diagrams/timeline/svgDraw.js on lines 233..242

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

                    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

                      _drawTextCandidateFunc(conf)(
                        section.text,
                        g,
                        rect.x,
                        rect.y,
                    Severity: Major
                    Found in packages/mermaid/src/diagrams/user-journey/svgDraw.js and 1 other location - About 1 hr to fix
                    packages/mermaid/src/diagrams/timeline/svgDraw.js on lines 207..217

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

                      _drawTextCandidateFunc(conf)(
                        task.task,
                        g,
                        rect.x,
                        rect.y,
                    Severity: Minor
                    Found in packages/mermaid/src/diagrams/user-journey/svgDraw.js and 1 other location - About 40 mins to fix
                    packages/mermaid/src/diagrams/timeline/svgDraw.js on lines 279..289

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

                    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