ant-design/ant-design

View on GitHub
.dumi/theme/plugin.ts

Summary

Maintainability
C
1 day
Test Coverage

Function generatePreviewerProps has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

  generatePreviewerProps(...[props, opts]: any) {
    if (opts.type === 'external') {
      // try to find md file with the same name as the demo tsx file
      const locale = opts.mdAbsPath.match(/index\.([a-z-]+)\.md$/i)?.[1];
      const mdPath = opts.fileAbsPath!.replace(/\.\w+$/, '.md');
Severity: Minor
Found in .dumi/theme/plugin.ts - About 5 hrs 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

Function RoutesPlugin has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const RoutesPlugin = (api: IApi) => {
  // const ssrCssFileName = `ssr-${Date.now()}.css`;

  const writeCSSFile = (key: string, hashKey: string, cssString: string) => {
    const fileName = `style-${key}.${getHash(hashKey)}.css`;
Severity: Major
Found in .dumi/theme/plugin.ts - About 3 hrs to fix

    Function generatePreviewerProps has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      generatePreviewerProps(...[props, opts]: any) {
        if (opts.type === 'external') {
          // try to find md file with the same name as the demo tsx file
          const locale = opts.mdAbsPath.match(/index\.([a-z-]+)\.md$/i)?.[1];
          const mdPath = opts.fileAbsPath!.replace(/\.\w+$/, '.md');
    Severity: Major
    Found in .dumi/theme/plugin.ts - About 2 hrs to fix

      There are no issues that match your filters.

      Category
      Status