Showing 384 of 1,490 total issues
File mermaid-graphlib.js
has 385 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/** Decorates with functions required by mermaids dagre-wrapper. */
import { log } from '../logger.js';
import * as graphlibJson from 'dagre-d3-es/src/graphlib/json.js';
import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';
Function setupNode
has 128 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const setupNode = (g, parent, parsedItem, diagramStates, diagramDb, altFlag) => {
const itemId = parsedItem.id;
const classStr = getClassesFromDbInfo(diagramStates[itemId]);
if (itemId !== 'root') {
File shapes.js
has 374 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { line, curveBasis } from 'd3';
import idCache from './id-cache.js';
import stateDb from './stateDb.js';
import utils from '../../utils.js';
import common from '../common/common.js';
Function drawEdge
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const drawEdge = function (elem, path, relation, conf, diagObj) {
const getRelationType = function (type) {
switch (type) {
case diagObj.db.relationType.AGGREGATION:
return 'aggregation';
Function draw
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const draw = (txt: string, id: string, _version: string, diagObj: Diagram) => {
function getDominantBaseLine(horizontalPos: TextHorizontalPos) {
return horizontalPos === 'top' ? 'hanging' : 'middle';
}
File classDb.ts
has 372 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import type { Selection } from 'd3';
import { select } from 'd3';
import { log } from '../../logger.js';
import { getConfig } from '../../diagram-api/diagramAPI.js';
import common from '../common/common.js';
Function draw
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const draw: DrawDefinition = (text, id, _version, diagObj) => {
log.debug('rendering pie chart\n' + text);
const db = diagObj.db as PieDB;
const globalConfig: MermaidConfig = getConfig();
const pieConfig: Required<PieDiagramConfig> = cleanAndMerge(db.getConfig(), globalConfig.pie);
Function drawText
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const drawText = function (elem, textData) {
let prevTextHeight = 0;
let textHeight = 0;
const lines = textData.text.split(common.lineBreakRegex);
File stateDiagram.spec.js
has 367 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
describe('State diagram', () => {
it('should render a simple state diagrams', () => {
imgSnapshotTest(
Function draw
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const draw = function (text: string, id: string, _version: string, diagObj: Diagram): void {
// Get Sankey config
const { securityLevel, sankey: conf } = getConfig();
const defaultSankeyConfig = defaultConfig!.sankey!;
File block.spec.js
has 361 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { imgSnapshotTest } from '../../helpers/util';
/* eslint-disable no-useless-escape */
describe('Block diagram', () => {
it('BL1: should calculate the block widths', () => {
imgSnapshotTest(
Function recursiveRender
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const recursiveRender = async (_elem, graph, diagramType, id, parentCluster, siteConfig) => {
log.info('Graph in recursive render: XXX', graphlibJson.write(graph), parentCluster);
const dir = graph.graph().rankdir;
log.trace('Dir in recursive render - dir:', dir);
Function addEdges
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const addEdges = async function (edges, g, diagObj) {
log.info('abc78 edges = ', edges);
let cnt = 0;
let linkIdCnt = {};
File edges.js
has 353 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { log } from '../logger.js';
import createLabel from './createLabel.js';
import { createText } from '../rendering-util/createText.js';
import { line, curveBasis, select } from 'd3';
import { getConfig } from '../diagram-api/diagramAPI.js';
Function draw
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const draw = async function (text, id, _version, diagObj) {
log.info('Drawing flowchart');
// Fetch the default direction, use TD if none was found
let dir = diagObj.db.getDirection();
Function setBlockSizes
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function setBlockSizes(block: Block, db: BlockDB, siblingWidth = 0, siblingHeight = 0) {
log.debug(
'setBlockSizes abc95 (start)',
block.id,
block?.size?.x,
File stateDiagram-v2.spec.js
has 351 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { parser } from './parser/stateDiagram.jison';
import stateDb from './stateDb.js';
import stateDiagram from './parser/stateDiagram.jison';
describe('state diagram V2, ', function () {
Function adjustClustersAndEdges
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const adjustClustersAndEdges = (graph, depth) => {
if (!graph || depth > 10) {
log.debug('Opting out, no graph ');
return;
} else {
Function drawArrow
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const drawArrow = (svg, commitA, commitB, allCommits) => {
const p1 = commitPos[commitA.id]; // arrowStart
const p2 = commitPos[commitB.id]; // arrowEnd
const arrowNeedsRerouting = shouldRerouteArrow(commitA, commitB, p1, p2, allCommits);
// log.debug('drawArrow', p1, p2, arrowNeedsRerouting, commitA.id, commitB.id);
Function calculateLoopBounds
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const calculateLoopBounds = async function (messages, actors, _maxWidthPerActor, diagObj) {
const loops = {};
const stack = [];
let current, noteModel, msgModel;