knsv/mermaid

View on GitHub

Showing 1,106 of 1,490 total issues

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

    it('should handle abstract methods', function () {
      const str = 'classDiagram\n' + 'class Class1\n' + 'Class1 : someMethod()*';
      parser.parse(str);

      const actual = parser.yy.getClass('Class1');
Severity: Major
Found in packages/mermaid/src/diagrams/class/classDiagram.spec.ts and 3 other locations - About 7 hrs to fix
packages/mermaid/src/diagrams/class/classDiagram.spec.ts on lines 912..923
packages/mermaid/src/diagrams/class/classDiagram.spec.ts on lines 1339..1350
packages/mermaid/src/diagrams/class/classDiagram.spec.ts on lines 1352..1363

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

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

  it('7-elk: should render a flowchart when useMaxWidth is true (default)', () => {
    renderGraph(
      `flowchart-elk TD
      A[Christmas] -->|Get money| B(Go shopping)
      B --> C{Let me think}
Severity: Major
Found in cypress/integration/rendering/flowchart-elk.spec.js and 1 other location - About 7 hrs to fix
cypress/integration/rendering/flowchart.spec.js on lines 734..756

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

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

  it('38: should render a flowchart when useMaxWidth is true (default)', () => {
    renderGraph(
      `graph TD
      A[Christmas] -->|Get money| B(Go shopping)
      B --> C{Let me think}
Severity: Major
Found in cypress/integration/rendering/flowchart.spec.js and 1 other location - About 7 hrs to fix
cypress/integration/rendering/flowchart-elk.spec.js on lines 92..114

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

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

    it('should parse two classes with text labels and css classes', () => {
      parser.parse(`classDiagram
class C1["Class 1 with text label"] {
  +member1
}
Severity: Major
Found in packages/mermaid/src/diagrams/class/classDiagram.spec.ts and 1 other location - About 7 hrs to fix
packages/mermaid/src/diagrams/class/classDiagram.spec.ts on lines 1721..1739

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

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

    it('should parse two classes with text labels and css class shorthands', () => {
      parser.parse(`classDiagram
class C1["Class 1 with text label"]:::styleClass1 {
  +member1
}
Severity: Major
Found in packages/mermaid/src/diagrams/class/classDiagram.spec.ts and 1 other location - About 7 hrs to fix
packages/mermaid/src/diagrams/class/classDiagram.spec.ts on lines 1700..1719

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

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

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

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

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

Refactorings

Further Reading

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

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

Duplicated Code

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

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

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

Tuning

This issue has a mass of 181.

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

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

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

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

Refactorings

Further Reading

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

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

Duplicated Code

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

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

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

Tuning

This issue has a mass of 181.

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

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

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

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

Refactorings

Further Reading

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

    it('MMP-8 should handle an id and type for a node definition', function () {
      const str = `mindmap
    root
      theId(child1)`;

Severity: Major
Found in packages/mermaid/src/diagrams/mindmap/mindmap.spec.ts and 1 other location - About 7 hrs to fix
packages/mermaid/src/diagrams/mindmap/mindmap.spec.ts on lines 106..119

Duplicated Code

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

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

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

Tuning

This issue has a mass of 180.

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

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

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

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

Refactorings

Further Reading

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

    it('MMP-9 should handle an id and type for a node definition', function () {
      const str = `mindmap
root
      theId(child1)`;

Severity: Major
Found in packages/mermaid/src/diagrams/mindmap/mindmap.spec.ts and 1 other location - About 7 hrs to fix
packages/mermaid/src/diagrams/mindmap/mindmap.spec.ts on lines 92..105

Duplicated Code

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

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

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

Tuning

This issue has a mass of 180.

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

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

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

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

Refactorings

Further Reading

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

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

Duplicated Code

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

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

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

Tuning

This issue has a mass of 180.

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

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

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

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

Refactorings

Further Reading

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

  insert: function (startx, starty, stopx, stopy) {
    const _startx = Math.min(startx, stopx);
    const _stopx = Math.max(startx, stopx);
    const _starty = Math.min(starty, stopy);
    const _stopy = Math.max(starty, stopy);
packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 133..145

Duplicated Code

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

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

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

Tuning

This issue has a mass of 180.

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

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

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

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

Refactorings

Further Reading

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

  it('should handle opt statements', async () => {
    const str = `
sequenceDiagram
Alice->Bob: Hello Bob, how are you?

packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 306..322
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 617..635
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 636..656
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 657..671
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 672..691
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 692..711
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 712..736
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 882..904
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 979..1004

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

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

  it('should handle comments in a sequenceDiagram', async () => {
    const str = `
      sequenceDiagram
      Alice->Bob: Hello Bob, how are you?
      %% Comment
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 306..322
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 636..656
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 657..671
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 672..691
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 692..711
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 712..736
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 882..904
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 956..978
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 979..1004

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

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

  it('should handle new lines in a sequenceDiagram', async () => {
    const str = `
      sequenceDiagram
      Alice->Bob: Hello Bob, how are you?

packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 306..322
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 617..635
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 657..671
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 672..691
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 692..711
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 712..736
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 882..904
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 956..978
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 979..1004

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

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

  it('should handle one leading space in lines in a sequenceDiagram', async () => {
    const str = `
sequenceDiagram
 Alice->Bob: Hello Bob, how are you?

packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 306..322
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 617..635
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 636..656
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 657..671
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 692..711
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 712..736
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 882..904
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 956..978
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 979..1004

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

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

  it('should handle semicolons', async () => {
    const str = `
sequenceDiagram;Alice->Bob: Hello Bob, how are you?;Note right of Bob: Bob thinks;Bob-->Alice: I am good thanks!;`;

    await mermaidAPI.parse(str);
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 306..322
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 617..635
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 636..656
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 672..691
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 692..711
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 712..736
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 882..904
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 956..978
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 979..1004

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

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

  it('should handle loop statements', async () => {
    const str = `
sequenceDiagram
Alice->Bob: Hello Bob, how are you?

packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 306..322
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 617..635
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 636..656
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 657..671
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 672..691
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 692..711
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 712..736
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 956..978
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 979..1004

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

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

  it('should space in actor names', async () => {
    const str = `
sequenceDiagram
Alice->Bob:Hello Bob, how are - you?
Bob-->Alice: I am good thanks!`;
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 617..635
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 636..656
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 657..671
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 672..691
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 692..711
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 712..736
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 882..904
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 956..978
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 979..1004

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

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

  it('should handle alt statements', async () => {
    const str = `
sequenceDiagram
Alice->Bob: Hello Bob, how are you?

packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 306..322
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 617..635
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 636..656
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 657..671
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 672..691
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 692..711
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 712..736
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 882..904
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 956..978

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

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

  it('should handle several leading spaces in lines in a sequenceDiagram', async () => {
    const str = `
sequenceDiagram
   Alice->Bob: Hello Bob, how are you?

packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 306..322
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 617..635
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 636..656
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 657..671
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 672..691
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 712..736
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 882..904
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 956..978
packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js on lines 979..1004

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

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

Severity
Category
Status
Source
Language