ant-design/ant-design

View on GitHub
components/date-picker/style/panel.ts

Summary

Maintainability
F
4 days
Test Coverage

Function genPanelStyle has 399 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const genPanelStyle = (token: SharedPickerToken): CSSObject => {
  const {
    componentCls,
    pickerCellCls,
    pickerCellInnerCls,
Severity: Major
Found in components/date-picker/style/panel.ts - About 1 day to fix

    File panel.ts has 579 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { unit } from '@ant-design/cssinjs';
    import type { CSSObject } from '@ant-design/cssinjs';
    import { TinyColor } from '@ctrl/tinycolor';
    
    import type { GenerateStyle } from '../../theme/internal';
    Severity: Major
    Found in components/date-picker/style/panel.ts - About 1 day to fix

      Function genPickerCellInnerStyle has 110 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const genPickerCellInnerStyle = (token: SharedPickerToken): CSSObject => {
        const {
          pickerCellCls,
          pickerCellInnerCls,
          cellHeight,
      Severity: Major
      Found in components/date-picker/style/panel.ts - About 4 hrs to fix

        Function genPickerPanelStyle has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const genPickerPanelStyle: GenerateStyle<PickerToken> = (token) => {
          const {
            componentCls,
            textHeight,
            lineWidth,
        Severity: Major
        Found in components/date-picker/style/panel.ts - About 2 hrs to fix

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

            const {
              pickerCellCls,
              pickerCellInnerCls,
              cellHeight,
              borderRadiusSM,
          Severity: Major
          Found in components/date-picker/style/panel.ts and 5 other locations - About 2 hrs to fix
          components/alert/style/index.ts on lines 47..62
          components/badge/style/index.ts on lines 100..115
          components/color-picker/style/input.ts on lines 8..23
          components/radio/style/index.ts on lines 542..557
          components/table/style/selection.ts on lines 8..23

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

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

            const {
              componentCls,
              textHeight,
              lineWidth,
              paddingSM,
          Severity: Major
          Found in components/date-picker/style/panel.ts and 7 other locations - About 1 hr to fix
          components/_util/ActionButton.tsx on lines 30..41
          components/avatar/style/index.ts on lines 167..178
          components/color-picker/style/index.ts on lines 125..136
          components/float-button/style/index.ts on lines 214..225
          components/float-button/style/index.ts on lines 377..388
          components/select/style/multiple.ts on lines 100..111
          components/steps/style/index.ts on lines 434..445

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

          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

                    lineHeight: unit(token.calc(textHeight).sub(token.calc(lineWidth).mul(2)).equal()),
          Severity: Minor
          Found in components/date-picker/style/panel.ts and 2 other locations - About 40 mins to fix
          components/color-picker/style/input.ts on lines 92..92
          components/date-picker/style/panel.ts on lines 681..681

          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

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

                    lineHeight: unit(token.calc(textHeight).sub(token.calc(lineWidth).mul(2)).equal()),
          Severity: Minor
          Found in components/date-picker/style/panel.ts and 2 other locations - About 40 mins to fix
          components/color-picker/style/input.ts on lines 92..92
          components/date-picker/style/panel.ts on lines 656..656

          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