knsv/mermaid

View on GitHub

Showing 1,488 of 1,488 total issues

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

export const addContainerBoundary = function (alias, label, type, tags, link) {
  // if (parentBoundary === null) return;

  // Don't allow label nulling
  if (alias === null || label === null) {
Severity: Major
Found in packages/mermaid/src/diagrams/c4/c4Db.js and 1 other location - About 2 days to fix
packages/mermaid/src/diagrams/c4/c4Db.js on lines 306..359

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

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

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

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

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

Refactorings

Further Reading

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

export const addPersonOrSystemBoundary = function (alias, label, type, tags, link) {
  // if (parentBoundary === null) return;

  // Don't allow label nulling
  if (alias === null || label === null) {
Severity: Major
Found in packages/mermaid/src/diagrams/c4/c4Db.js and 1 other location - About 2 days to fix
packages/mermaid/src/diagrams/c4/c4Db.js on lines 362..415

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

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

File gitGraph.spec.js has 1003 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { imgSnapshotTest } from '../../helpers/util.ts';

describe('Git Graph diagram', () => {
  it('1: should render a simple gitgraph with commit on main branch', () => {
    imgSnapshotTest(
Severity: Major
Found in cypress/integration/rendering/gitGraph.spec.js - About 2 days to fix

    File sequencediagram.spec.js has 986 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /// <reference types="Cypress" />
    
    import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
    
    context('Sequence diagram', () => {
    Severity: Major
    Found in cypress/integration/rendering/sequencediagram.spec.js - About 2 days to fix

      File nodes.js has 982 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { select } from 'd3';
      import { log } from '../logger.js';
      import { labelHelper, updateNodeBounds, insertPolygonShape } from './shapes/util.js';
      import { getConfig } from '../diagram-api/diagramAPI.js';
      import intersect from './intersect/index.js';
      Severity: Major
      Found in packages/mermaid/src/dagre-wrapper/nodes.js - About 2 days to fix

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

          describe('Markdown strings flowchart-elk (#4220)', () => {
            describe('html labels', () => {
              it('With styling and classes', () => {
                imgSnapshotTest(
                  `%%{init: {"flowchart": {"htmlLabels": true}} }%%
        Severity: Major
        Found in cypress/integration/rendering/flowchart-elk.spec.js and 1 other location - About 2 days to fix
        cypress/integration/rendering/flowchart-v2.spec.js on lines 763..907

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

        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('Markdown strings flowchart (#4220)', () => {
            describe('html labels', () => {
              it('With styling and classes', () => {
                imgSnapshotTest(
                  `%%{init: {"flowchart": {"htmlLabels": true}} }%%
        Severity: Major
        Found in cypress/integration/rendering/flowchart-v2.spec.js and 1 other location - About 2 days to fix
        cypress/integration/rendering/flowchart-elk.spec.js on lines 701..845

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

        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

        File flowchart-v2.spec.js has 943 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
        
        describe('Flowchart v2', () => {
          it('1: should render a simple flowchart', () => {
            imgSnapshotTest(
        Severity: Major
        Found in cypress/integration/rendering/flowchart-v2.spec.js - About 2 days to fix

          File gitGraphParserV2.spec.js has 913 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import gitGraphAst from './gitGraphAst.js';
          import { parser } from './parser/gitGraph.jison';
          
          describe('when parsing a gitGraph', function () {
            beforeEach(function () {
          Severity: Major
          Found in packages/mermaid/src/diagrams/git/gitGraphParserV2.spec.js - About 2 days to fix

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

                it('should parse classes with different text labels', () => {
                  parser.parse(`classDiagram
            class C1["OneWord"]
            class C2["With, Comma"]
            class C3["With (Brackets)"]
            Severity: Major
            Found in packages/mermaid/src/diagrams/class/classDiagram.spec.ts and 1 other location - About 2 days to fix
            packages/mermaid/src/diagrams/class/classDiagram.spec.ts on lines 1760..1789

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

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

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

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

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

            Refactorings

            Further Reading

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

                it('should parse classes with different text labels', () => {
                  parser.parse(`classDiagram
            class C1["OneWord"]
            class C2["With, Comma"]
            class C3["With (Brackets)"]
            Severity: Major
            Found in packages/mermaid/src/diagrams/class/classDiagram.spec.ts and 1 other location - About 2 days to fix
            packages/mermaid/src/diagrams/class/classDiagram.spec.ts on lines 230..259

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

            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

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

            import common, { calculateMathMLDimensions, hasKatex, renderKatex } from '../common/common.js';
            import * as svgDrawCommon from '../common/svgDrawCommon.js';
            import { addFunction } from '../../interactionDb.js';
            import { ZERO_WIDTH_SPACE, parseFontSize } from '../../utils.js';
            import { sanitizeUrl } from '@braintree/sanitize-url';
            Severity: Major
            Found in packages/mermaid/src/diagrams/sequence/svgDraw.js - About 2 days to fix

              File flowchart.spec.js has 864 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
              
              describe('Graph', () => {
                it('1: should render a simple flowchart no htmlLabels', () => {
                  imgSnapshotTest(
              Severity: Major
              Found in cypress/integration/rendering/flowchart.spec.js - About 2 days to fix

                File flowchart-elk.spec.js has 802 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
                
                describe.skip('Flowchart ELK', () => {
                  it('1-elk: should render a simple flowchart', () => {
                    imgSnapshotTest(
                Severity: Major
                Found in cypress/integration/rendering/flowchart-elk.spec.js - About 1 day to fix

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

                      if (this.darkMode) {
                        this.git0 = lighten(this.git0, 25);
                        this.git1 = lighten(this.git1, 25);
                        this.git2 = lighten(this.git2, 25);
                        this.git3 = lighten(this.git3, 25);
                  Severity: Major
                  Found in packages/mermaid/src/themes/theme-base.js and 2 other locations - About 1 day to fix
                  packages/mermaid/src/themes/theme-default.js on lines 310..328
                  packages/mermaid/src/themes/theme-forest.js on lines 278..296

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

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

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

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

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

                  Refactorings

                  Further Reading

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

                      if (this.darkMode) {
                        this.git0 = lighten(this.git0, 25);
                        this.git1 = lighten(this.git1, 25);
                        this.git2 = lighten(this.git2, 25);
                        this.git3 = lighten(this.git3, 25);
                  Severity: Major
                  Found in packages/mermaid/src/themes/theme-forest.js and 2 other locations - About 1 day to fix
                  packages/mermaid/src/themes/theme-base.js on lines 285..303
                  packages/mermaid/src/themes/theme-default.js on lines 310..328

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

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

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

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

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

                  Refactorings

                  Further Reading

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

                      if (this.darkMode) {
                        this.git0 = lighten(this.git0, 25);
                        this.git1 = lighten(this.git1, 25);
                        this.git2 = lighten(this.git2, 25);
                        this.git3 = lighten(this.git3, 25);
                  Severity: Major
                  Found in packages/mermaid/src/themes/theme-default.js and 2 other locations - About 1 day to fix
                  packages/mermaid/src/themes/theme-base.js on lines 285..303
                  packages/mermaid/src/themes/theme-forest.js on lines 278..296

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

                  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 updateFn(type?: 'activation') {
                        return function updateItemBounds(item) {
                          cnt++;
                          // The loop sequenceItems is a stack so the biggest margins in the beginning of the sequenceItems
                          const n = _self.sequenceItems.length - cnt + 1;
                  packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts on lines 108..128

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

                  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 updateFn(type?: 'activation') {
                        return function updateItemBounds(item) {
                          cnt++;
                          // The loop sequenceItems is a stack so the biggest margins in the beginning of the sequenceItems
                          const n = _self.sequenceItems.length - cnt + 1;
                  Severity: Major
                  Found in packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts and 1 other location - About 1 day to fix
                  packages/mermaid/src/diagrams/user-journey/journeyRenderer.ts on lines 156..175

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

                  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

                  File c4Db.js has 733 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { getConfig } from '../../diagram-api/diagramAPI.js';
                  import { sanitizeText } from '../common/common.js';
                  import {
                    setAccTitle,
                    getAccTitle,
                  Severity: Major
                  Found in packages/mermaid/src/diagrams/c4/c4Db.js - About 1 day to fix
                    Severity
                    Category
                    Status
                    Source
                    Language