knsv/mermaid

View on GitHub
packages/mermaid/src/diagrams/class/classTypes.spec.ts

Summary

Maintainability
F
1 mo
Test Coverage

File classTypes.spec.ts has 572 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { ClassMember } from './classTypes.js';
import { vi, describe, it, expect } from 'vitest';
const spyOn = vi.spyOn;

const staticCssStyle = 'text-decoration:underline;';
Severity: Major
Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts - About 1 day to fix

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

      describe('when method return type is a nested generic', function () {
        it('should parse correctly', function () {
          const str = `getTimetableList() List~List~T~~`;
    
          const classMember = new ClassMember(str, 'method');
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 5 other locations - About 2 days to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 274..325
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 327..378
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 380..431
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 433..484
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 545..596

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

    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

      describe('when method has single parameter type and name (type first)', function () {
        it('should parse correctly', function () {
          const str = `getTime(int count)`;
    
          const classMember = new ClassMember(str, 'method');
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 3 other locations - About 2 days to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 9..60
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 62..113
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 168..219

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

    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

      describe('when method has single parameter value', function () {
        it('should parse correctly', function () {
          const str = `getTime(int)`;
    
          const classMember = new ClassMember(str, 'method');
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 3 other locations - About 2 days to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 9..60
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 115..166
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 168..219

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

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

      describe('when method return type is generic', function () {
        it('should parse correctly', function () {
          const str = `getTimes() List~T~`;
    
          const classMember = new ClassMember(str, 'method');
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 5 other locations - About 2 days to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 274..325
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 327..378
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 380..431
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 433..484
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 598..663

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

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

      describe('when method has return type', function () {
        it('should parse correctly', function () {
          const str = `getTime() DateTime`;
    
          const classMember = new ClassMember(str, 'method');
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 5 other locations - About 2 days to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 327..378
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 380..431
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 433..484
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 545..596
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 598..663

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

    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

      describe('when method has no parameters', function () {
        it('should parse correctly', function () {
          const str = `getTime()`;
    
          const classMember = new ClassMember(str, 'method');
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 3 other locations - About 2 days to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 62..113
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 115..166
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 168..219

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

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

      describe('when method parameter contains two generic', function () {
        it('should parse correctly', function () {
          const str = `getTimes(List~T~, List~OT~)`;
    
          const classMember = new ClassMember(str, 'method');
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 5 other locations - About 2 days to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 274..325
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 327..378
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 433..484
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 545..596
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 598..663

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

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

      describe('when method parameter is generic', function () {
        it('should parse correctly', function () {
          const str = `getTimes(List~T~)`;
    
          const classMember = new ClassMember(str, 'method');
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 5 other locations - About 2 days to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 274..325
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 380..431
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 433..484
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 545..596
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 598..663

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

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

      describe('when method parameter is a nested generic', function () {
        it('should parse correctly', function () {
          const str = `getTimetableList(List~List~T~~)`;
    
          const classMember = new ClassMember(str, 'method');
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 5 other locations - About 2 days to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 274..325
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 327..378
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 380..431
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 545..596
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 598..663

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

    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

      describe('when method has single parameter type and name (name first)', function () {
        it('should parse correctly', function () {
          const str = `getTime(count int)`;
    
          const classMember = new ClassMember(str, 'method');
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 3 other locations - About 2 days to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 9..60
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 62..113
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 115..166

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

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

      describe('when the attribute has no modifiers', () => {
        it('should parse the display text correctly', () => {
          const str = 'name String';
    
          const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 4 other locations - About 2 hrs to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 697..706
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 708..717
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 719..728
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 730..739

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 90.

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

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

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

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

    Refactorings

    Further Reading

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

      describe('when the attribute has protected "#" modifier', () => {
        it('should parse the display text correctly', () => {
          const str = '#name String';
    
          const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 4 other locations - About 2 hrs to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 686..695
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 697..706
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 719..728
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 730..739

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 90.

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

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

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

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

    Refactorings

    Further Reading

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

      describe('when the attribute has static "$" modifier', () => {
        it('should parse the display text correctly and apply static css style', () => {
          const str = 'name String$';
    
          const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 1 other location - About 2 hrs to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 752..761

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 90.

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

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

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

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

    Refactorings

    Further Reading

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

      describe('when the attribute has public "+" modifier', () => {
        it('should parse the display text correctly', () => {
          const str = '+name String';
    
          const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 4 other locations - About 2 hrs to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 686..695
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 708..717
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 719..728
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 730..739

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 90.

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

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

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

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

    Refactorings

    Further Reading

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

      describe('when the attribute has private "-" modifier', () => {
        it('should parse the display text correctly', () => {
          const str = '-name String';
    
          const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 4 other locations - About 2 hrs to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 686..695
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 697..706
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 708..717
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 730..739

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 90.

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

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

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

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

    Refactorings

    Further Reading

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

      describe('when the attribute has abstract "*" modifier', () => {
        it('should parse the display text correctly and apply abstract css style', () => {
          const str = 'name String*';
    
          const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 1 other location - About 2 hrs to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 741..750

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 90.

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

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

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

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

    Refactorings

    Further Reading

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

      describe('when the attribute has internal "~" modifier', () => {
        it('should parse the display text correctly', () => {
          const str = '~name String';
    
          const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 4 other locations - About 2 hrs to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 686..695
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 697..706
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 708..717
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 719..728

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 90.

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

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

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

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

    Refactorings

    Further Reading

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

        it('should return correct css for static classifier', function () {
          const str = methodNameAndParameters + '$';
          const classMember = new ClassMember(str, 'method');
          expect(classMember.getDisplayDetails().displayText).toBe(expectedMethodNameAndParameters);
          expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 1 other location - About 2 hrs to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 537..542

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 88.

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

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

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

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

    Refactorings

    Further Reading

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

        it('should return correct css for abstract classifier', function () {
          const str = methodNameAndParameters + '*';
          const classMember = new ClassMember(str, 'method');
          expect(classMember.getDisplayDetails().displayText).toBe(expectedMethodNameAndParameters);
          expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 1 other location - About 2 hrs to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 530..535

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 88.

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

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

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

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

    Refactorings

    Further Reading

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

        it('should handle public visibility', function () {
          const str = '+' + methodNameAndParameters;
    
          const classMember = new ClassMember(str, 'method');
          expect(classMember.getDisplayDetails().displayText).toBe(
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 3 other locations - About 1 hr to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 505..511
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 513..519
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 521..528

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 66.

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

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

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

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

    Refactorings

    Further Reading

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

        it('should handle private visibility', function () {
          const str = '-' + methodNameAndParameters;
          const classMember = new ClassMember(str, 'method');
          expect(classMember.getDisplayDetails().displayText).toBe(
            '-' + expectedMethodNameAndParameters
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 3 other locations - About 1 hr to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 496..503
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 513..519
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 521..528

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 66.

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

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

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

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

    Refactorings

    Further Reading

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

        it('should handle protected visibility', function () {
          const str = '#' + methodNameAndParameters;
          const classMember = new ClassMember(str, 'method');
          expect(classMember.getDisplayDetails().displayText).toBe(
            '#' + expectedMethodNameAndParameters
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 3 other locations - About 1 hr to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 496..503
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 505..511
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 521..528

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 66.

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

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

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

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

    Refactorings

    Further Reading

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

        it('should handle internal visibility', function () {
          const str = '~' + methodNameAndParameters;
    
          const classMember = new ClassMember(str, 'method');
          expect(classMember.getDisplayDetails().displayText).toBe(
    Severity: Major
    Found in packages/mermaid/src/diagrams/class/classTypes.spec.ts and 3 other locations - About 1 hr to fix
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 496..503
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 505..511
    packages/mermaid/src/diagrams/class/classTypes.spec.ts on lines 513..519

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 66.

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

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

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

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

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status