ant-design/ant-design

View on GitHub
.dumi/theme/common/BehaviorMap/BehaviorMap.tsx

Summary

Maintainability
C
1 day
Test Coverage

Function draw has 97 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    draw: (cfg, group) => {
      const textWidth = G6.Util.getTextSize(cfg!.label, 14)[0];
      const padding = 16;
      const size = [textWidth + 16 * 2 + (cfg!.targetType ? 12 : 0) + (cfg!.link ? 20 : 0), 40];
      const keyShape = group!.addShape('rect', {
Severity: Major
Found in .dumi/theme/common/BehaviorMap/BehaviorMap.tsx - About 3 hrs to fix

    File BehaviorMap.tsx has 318 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { useEffect, useRef } from 'react';
    import G6 from '@antv/g6';
    import { createStyles, css } from 'antd-style';
    import { useRouteMeta } from 'dumi';
    
    
    Severity: Minor
    Found in .dumi/theme/common/BehaviorMap/BehaviorMap.tsx - About 3 hrs to fix

      Function draw has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          draw: (cfg, group) => {
            const textWidth = G6.Util.getTextSize(cfg!.label, 14)[0];
            const padding = 16;
            const size = [textWidth + 16 * 2 + (cfg!.targetType ? 12 : 0) + (cfg!.link ? 20 : 0), 40];
            const keyShape = group!.addShape('rect', {
      Severity: Minor
      Found in .dumi/theme/common/BehaviorMap/BehaviorMap.tsx - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      There are no issues that match your filters.

      Category
      Status