ant-design/ant-design

View on GitHub
components/menu/style/index.ts

Summary

Maintainability
F
5 days
Test Coverage

File index.ts has 670 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import type { CSSProperties } from 'react';
import type { CSSObject } from '@ant-design/cssinjs';
import { unit } from '@ant-design/cssinjs';
import { TinyColor } from '@ctrl/tinycolor';
import type { CssUtil } from 'antd-style';
Severity: Major
Found in components/menu/style/index.ts - About 1 day to fix

    Function getBaseStyle has 237 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const getBaseStyle: GenerateStyle<MenuToken> = (token) => {
      const {
        antCls,
        componentCls,
        fontSize,
    Severity: Major
    Found in components/menu/style/index.ts - About 1 day to fix

      Function prepareComponentToken has 111 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const prepareComponentToken: GetDefaultToken<'Menu'> = (token) => {
        const {
          colorPrimary,
          colorError,
          colorTextDisabled,
      Severity: Major
      Found in components/menu/style/index.ts - About 4 hrs to fix

        Function useStyle has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            (token) => {
              const {
                colorBgElevated,
                controlHeightLG,
                fontSize,
        Severity: Major
        Found in components/menu/style/index.ts - About 2 hrs to fix

          Function genMenuItemStyle has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const genMenuItemStyle = (token: MenuToken): CSSObject => {
            const {
              componentCls,
              motionDurationSlow,
              motionDurationMid,
          Severity: Major
          Found in components/menu/style/index.ts - About 2 hrs to fix

            Function genSubMenuArrowStyle has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const genSubMenuArrowStyle = (token: MenuToken): CSSObject => {
              const {
                componentCls,
                motionDurationSlow,
                motionEaseInOut,
            Severity: Minor
            Found in components/menu/style/index.ts - About 1 hr to fix

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

                const {
                  colorPrimary,
                  colorError,
                  colorTextDisabled,
                  colorErrorBg,
              Severity: Major
              Found in components/menu/style/index.ts and 1 other location - About 4 hrs to fix
              components/color-picker/style/index.ts on lines 165..189

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

              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

                    const {
                      colorBgElevated,
                      controlHeightLG,
                      fontSize,
                      darkItemColor,
              Severity: Major
              Found in components/menu/style/index.ts and 3 other locations - About 3 hrs to fix
              components/input/style/token.ts on lines 107..127
              components/skeleton/style/index.ts on lines 235..255
              components/table/style/expand.ts on lines 9..29

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

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

                const {
                  antCls,
                  componentCls,
                  fontSize,
                  motionDurationSlow,
              Severity: Major
              Found in components/menu/style/index.ts and 2 other locations - About 3 hrs to fix
              components/radio/style/index.ts on lines 124..143
              components/table/style/index.ts on lines 243..262

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

              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

                            paddingInline: `${unit(token.calc(fontSize).mul(2).equal())} ${unit(padding)}`,
              Severity: Major
              Found in components/menu/style/index.ts and 3 other locations - About 40 mins to fix
              components/menu/style/vertical.ts on lines 187..189
              components/result/style/index.ts on lines 57..57
              components/tooltip/style/index.ts on lines 66..66

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

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

                        '&::after': {
                          transform: `rotate(45deg) translateX(${unit(
                            token.calc(menuArrowOffset).mul(-1).equal(),
                          )})`,
                        },
              Severity: Major
              Found in components/menu/style/index.ts and 2 other locations - About 40 mins to fix
              components/menu/style/index.ts on lines 497..501
              components/menu/style/index.ts on lines 783..787

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

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

                      '&::before': {
                        transform: `rotate(45deg) translateY(${unit(
                          token.calc(menuArrowOffset).mul(-1).equal(),
                        )})`,
                      },
              Severity: Major
              Found in components/menu/style/index.ts and 2 other locations - About 40 mins to fix
              components/menu/style/index.ts on lines 771..775
              components/menu/style/index.ts on lines 783..787

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

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

                          '&::after': {
                            transform: `rotate(-45deg) translateX(${unit(
                              token.calc(menuArrowOffset).mul(-1).equal(),
                            )})`,
                          },
              Severity: Major
              Found in components/menu/style/index.ts and 2 other locations - About 40 mins to fix
              components/menu/style/index.ts on lines 497..501
              components/menu/style/index.ts on lines 771..775

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

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

                const {
                  componentCls,
                  motionDurationSlow,
                  motionDurationMid,
                  motionEaseInOut,
              Severity: Major
              Found in components/menu/style/index.ts and 17 other locations - About 40 mins to fix
              .dumi/hooks/useMenu.tsx on lines 45..45
              .dumi/pages/index/components/Group.tsx on lines 40..40
              .dumi/theme/slots/Header/Navigation.tsx on lines 33..42
              components/anchor/style/index.ts on lines 29..38
              components/button/style/index.ts on lines 405..414
              components/calendar/Header.tsx on lines 26..27
              components/calendar/Header.tsx on lines 80..81
              components/card/style/index.ts on lines 275..284
              components/layout/style/index.ts on lines 284..293
              components/list/style/index.ts on lines 73..82
              components/menu/style/vertical.ts on lines 9..18
              components/statistic/style/index.ts on lines 23..32
              components/switch/style/index.ts on lines 87..96
              components/table/style/bordered.ts on lines 8..17
              components/table/style/fixed.ts on lines 7..16
              components/tabs/style/index.ts on lines 659..668
              components/typography/Base/Ellipsis.tsx on lines 129..129

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

              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