knsv/mermaid

View on GitHub
packages/mermaid/src/diagrams/er/erMarkers.js

Summary

Maintainability
F
5 days
Test Coverage

Function insertMarkers has 152 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const insertMarkers = function (elem, conf) {
  let marker;

  elem
    .append('defs')
Severity: Major
Found in packages/mermaid/src/diagrams/er/erMarkers.js - About 6 hrs to fix

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

      elem
        .append('defs')
        .append('marker')
        .attr('id', ERMarkers.ONLY_ONE_END)
        .attr('refX', 18)
    Severity: Major
    Found in packages/mermaid/src/diagrams/er/erMarkers.js and 3 other locations - About 4 hrs to fix
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 47..59
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 111..123
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 125..137

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

    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

      elem
        .append('defs')
        .append('marker')
        .attr('id', ERMarkers.ONLY_ONE_START)
        .attr('refX', 0)
    Severity: Major
    Found in packages/mermaid/src/diagrams/er/erMarkers.js and 3 other locations - About 4 hrs to fix
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 61..73
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 111..123
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 125..137

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

    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

      elem
        .append('defs')
        .append('marker')
        .attr('id', ERMarkers.ONE_OR_MORE_START)
        .attr('refX', 18)
    Severity: Major
    Found in packages/mermaid/src/diagrams/er/erMarkers.js and 3 other locations - About 4 hrs to fix
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 47..59
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 61..73
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 125..137

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

    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

      elem
        .append('defs')
        .append('marker')
        .attr('id', ERMarkers.ONE_OR_MORE_END)
        .attr('refX', 27)
    Severity: Major
    Found in packages/mermaid/src/diagrams/er/erMarkers.js and 3 other locations - About 4 hrs to fix
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 47..59
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 61..73
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 111..123

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

    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', ERMarkers.MD_PARENT_END)
        .attr('refX', 19)
    Severity: Major
    Found in packages/mermaid/src/diagrams/er/erMarkers.js and 1 other location - About 2 hrs to fix
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 23..33

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

    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', ERMarkers.MD_PARENT_START)
        .attr('refX', 0)
    Severity: Major
    Found in packages/mermaid/src/diagrams/er/erMarkers.js and 1 other location - About 2 hrs to fix
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 35..45

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

    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

      marker = elem
        .append('defs')
        .append('marker')
        .attr('id', ERMarkers.ZERO_OR_ONE_END)
        .attr('refX', 30)
    Severity: Major
    Found in packages/mermaid/src/diagrams/er/erMarkers.js and 3 other locations - About 2 hrs to fix
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 75..83
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 139..147
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 161..169

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

    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

      marker = elem
        .append('defs')
        .append('marker')
        .attr('id', ERMarkers.ZERO_OR_MORE_START)
        .attr('refX', 18)
    Severity: Major
    Found in packages/mermaid/src/diagrams/er/erMarkers.js and 3 other locations - About 2 hrs to fix
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 75..83
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 93..101
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 161..169

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

    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

      marker = elem
        .append('defs')
        .append('marker')
        .attr('id', ERMarkers.ZERO_OR_MORE_END)
        .attr('refX', 39)
    Severity: Major
    Found in packages/mermaid/src/diagrams/er/erMarkers.js and 3 other locations - About 2 hrs to fix
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 75..83
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 93..101
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 139..147

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

    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

      marker = elem
        .append('defs')
        .append('marker')
        .attr('id', ERMarkers.ZERO_OR_ONE_START)
        .attr('refX', 0)
    Severity: Major
    Found in packages/mermaid/src/diagrams/er/erMarkers.js and 3 other locations - About 2 hrs to fix
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 93..101
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 139..147
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 161..169

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

    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

      marker
        .append('circle')
        .attr('stroke', conf.stroke)
        .attr('fill', 'white')
        .attr('cx', 21)
    Severity: Major
    Found in packages/mermaid/src/diagrams/er/erMarkers.js and 3 other locations - About 1 hr to fix
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 102..108
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 148..154
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 170..176

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

      marker
        .append('circle')
        .attr('stroke', conf.stroke)
        .attr('fill', 'white')
        .attr('cx', 48)
    Severity: Major
    Found in packages/mermaid/src/diagrams/er/erMarkers.js and 3 other locations - About 1 hr to fix
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 84..90
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 102..108
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 170..176

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

      marker
        .append('circle')
        .attr('stroke', conf.stroke)
        .attr('fill', 'white')
        .attr('cx', 9)
    Severity: Major
    Found in packages/mermaid/src/diagrams/er/erMarkers.js and 3 other locations - About 1 hr to fix
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 84..90
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 102..108
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 148..154

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

      marker
        .append('circle')
        .attr('stroke', conf.stroke)
        .attr('fill', 'white')
        .attr('cx', 9)
    Severity: Major
    Found in packages/mermaid/src/diagrams/er/erMarkers.js and 3 other locations - About 1 hr to fix
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 84..90
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 148..154
    packages/mermaid/src/diagrams/er/erMarkers.js on lines 170..176

    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

    There are no issues that match your filters.

    Category
    Status