knsv/mermaid

View on GitHub
packages/mermaid/src/dagre-wrapper/markers.js

Summary

Maintainability
F
1 wk
Test Coverage

File markers.js has 277 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/** Setup arrow head and define the marker. The result is appended to the svg. */

import { log } from '../logger.js';

// Only add the number of markers that the diagram needs
Severity: Minor
Found in packages/mermaid/src/dagre-wrapper/markers.js - About 2 hrs to fix

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

    const circle = (elem, type, id) => {
      elem
        .append('marker')
        .attr('id', id + '_' + type + '-circleEnd')
        .attr('class', 'marker ' + type)
    Severity: Minor
    Found in packages/mermaid/src/dagre-wrapper/markers.js - About 1 hr to fix

      Function cross has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const cross = (elem, type, id) => {
        elem
          .append('marker')
          .attr('id', id + '_' + type + '-crossEnd')
          .attr('class', 'marker cross ' + type)
      Severity: Minor
      Found in packages/mermaid/src/dagre-wrapper/markers.js - About 1 hr to fix

        Function lollipop has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const lollipop = (elem, type, id) => {
          elem
            .append('defs')
            .append('marker')
            .attr('id', id + '_' + type + '-lollipopStart')
        Severity: Minor
        Found in packages/mermaid/src/dagre-wrapper/markers.js - About 1 hr to fix

          Function point has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const point = (elem, type, id) => {
            elem
              .append('marker')
              .attr('id', id + '_' + type + '-pointEnd')
              .attr('class', 'marker ' + type)
          Severity: Minor
          Found in packages/mermaid/src/dagre-wrapper/markers.js - About 1 hr to fix

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

            const dependency = (elem, type, id) => {
              elem
                .append('defs')
                .append('marker')
                .attr('id', id + '_' + type + '-dependencyStart')
            Severity: Major
            Found in packages/mermaid/src/dagre-wrapper/markers.js and 2 other locations - About 1 day to fix
            packages/mermaid/src/dagre-wrapper/markers.js on lines 41..67
            packages/mermaid/src/dagre-wrapper/markers.js on lines 68..94

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

            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

            const composition = (elem, type, id) => {
              elem
                .append('defs')
                .append('marker')
                .attr('id', id + '_' + type + '-compositionStart')
            Severity: Major
            Found in packages/mermaid/src/dagre-wrapper/markers.js and 2 other locations - About 1 day to fix
            packages/mermaid/src/dagre-wrapper/markers.js on lines 68..94
            packages/mermaid/src/dagre-wrapper/markers.js on lines 95..121

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

            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

            const aggregation = (elem, type, id) => {
              elem
                .append('defs')
                .append('marker')
                .attr('id', id + '_' + type + '-aggregationStart')
            Severity: Major
            Found in packages/mermaid/src/dagre-wrapper/markers.js and 2 other locations - About 1 day to fix
            packages/mermaid/src/dagre-wrapper/markers.js on lines 41..67
            packages/mermaid/src/dagre-wrapper/markers.js on lines 95..121

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

            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

              elem
                .append('marker')
                .attr('id', id + '_' + type + '-pointEnd')
                .attr('class', 'marker ' + type)
                .attr('viewBox', '0 0 10 10')
            Severity: Major
            Found in packages/mermaid/src/dagre-wrapper/markers.js and 1 other location - About 5 hrs to fix
            packages/mermaid/src/dagre-wrapper/markers.js on lines 174..189

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

            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

              elem
                .append('marker')
                .attr('id', id + '_' + type + '-pointStart')
                .attr('class', 'marker ' + type)
                .attr('viewBox', '0 0 10 10')
            Severity: Major
            Found in packages/mermaid/src/dagre-wrapper/markers.js and 1 other location - About 5 hrs to fix
            packages/mermaid/src/dagre-wrapper/markers.js on lines 158..173

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

            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

              elem
                .append('defs')
                .append('marker')
                .attr('id', id + '_' + type + '-lollipopStart')
                .attr('class', 'marker lollipop ' + type)
            Severity: Major
            Found in packages/mermaid/src/dagre-wrapper/markers.js and 1 other location - About 5 hrs to fix
            packages/mermaid/src/dagre-wrapper/markers.js on lines 140..155

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

            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

              elem
                .append('defs')
                .append('marker')
                .attr('id', id + '_' + type + '-lollipopEnd')
                .attr('class', 'marker lollipop ' + type)
            Severity: Major
            Found in packages/mermaid/src/dagre-wrapper/markers.js and 1 other location - About 5 hrs to fix
            packages/mermaid/src/dagre-wrapper/markers.js on lines 123..138

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

            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

              elem
                .append('marker')
                .attr('id', id + '_' + type + '-crossStart')
                .attr('class', 'marker cross ' + type)
                .attr('viewBox', '0 0 11 11')
            Severity: Major
            Found in packages/mermaid/src/dagre-wrapper/markers.js and 1 other location - About 3 hrs to fix
            packages/mermaid/src/dagre-wrapper/markers.js on lines 211..222

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

            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

              elem
                .append('marker')
                .attr('id', id + '_' + type + '-circleStart')
                .attr('class', 'marker ' + type)
                .attr('viewBox', '0 0 10 10')
            Severity: Major
            Found in packages/mermaid/src/dagre-wrapper/markers.js and 1 other location - About 3 hrs to fix
            packages/mermaid/src/dagre-wrapper/markers.js on lines 249..260

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

            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 insertMarkers = (elem, markerArray, type, id) => {
              markerArray.forEach((markerName) => {
                markers[markerName](elem, type, id);
              });
            };
            Severity: Minor
            Found in packages/mermaid/src/dagre-wrapper/markers.js and 1 other location - About 30 mins to fix
            packages/mermaid/src/dagre-wrapper/patterns.js on lines 6..10

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

            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