ant-design/ant-design

View on GitHub

Showing 1,102 of 3,485 total issues

Function genDrawerStyle has 190 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const genDrawerStyle: GenerateStyle<DrawerToken> = (token) => {
  const {
    borderRadiusSM,
    componentCls,
    zIndexPopup,
Severity: Major
Found in components/drawer/style/index.ts - About 7 hrs to fix

    Function Slider has 189 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Slider = React.forwardRef<SliderRef, SliderSingleProps | SliderRangeProps>((props, ref) => {
      const {
        prefixCls: customizePrefixCls,
        range,
        className,
    Severity: Major
    Found in components/slider/index.tsx - About 7 hrs to fix

      Function App has 189 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const App: React.FC = () => {
        const [form] = Form.useForm();
      
        const onFinish = (values: any) => {
          console.log('Received values of form: ', values);
      Severity: Major
      Found in components/form/demo/register.tsx - About 7 hrs to fix

        File index.test.tsx has 473 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import Dayjs from 'dayjs';
        
        import 'dayjs/locale/zh-cn';
        
        import React from 'react';
        Severity: Minor
        Found in components/calendar/__tests__/index.test.tsx - About 7 hrs to fix

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

          import { unit } from '@ant-design/cssinjs';
          
          import { genFocusOutline, resetComponent } from '../../style';
          import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
          import { genStyleHooks, mergeToken } from '../../theme/internal';
          Severity: Minor
          Found in components/radio/style/index.ts - About 7 hrs to fix

            Function List has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
            Open

            function List<T>({
              pagination = false as ListProps<T>['pagination'],
              prefixCls: customizePrefixCls,
              bordered = false,
              split = true,
            Severity: Minor
            Found in components/list/index.tsx - About 7 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 genTimelineStyle has 180 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const genTimelineStyle: GenerateStyle<TimelineToken, CSSObject> = (token) => {
              const { componentCls, calc } = token;
            
              return {
                [componentCls]: {
            Severity: Major
            Found in components/timeline/style/index.ts - About 7 hrs to fix

              Function InternalBadge has 178 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const InternalBadge = React.forwardRef<HTMLSpanElement, BadgeProps>((props, ref) => {
                const {
                  prefixCls: customizePrefixCls,
                  scrollNumberPrefixCls: customizeScrollNumberPrefixCls,
                  children,
              Severity: Major
              Found in components/badge/index.tsx - About 7 hrs to fix

                Function genCheckboxStyle has 177 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const genCheckboxStyle: GenerateStyle<CheckboxToken> = (token) => {
                  const { checkboxCls } = token;
                  const wrapperCls = `${checkboxCls}-wrapper`;
                
                  return [
                Severity: Major
                Found in components/checkbox/style/index.ts - About 7 hrs to fix

                  Function Affix has 175 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const Affix = React.forwardRef<AffixRef, AffixProps>((props, ref) => {
                    const {
                      style,
                      offsetTop,
                      offsetBottom,
                  Severity: Major
                  Found in components/affix/index.tsx - About 7 hrs to fix

                    Function InternalSelect has 174 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const InternalSelect = <
                      ValueType = any,
                      OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,
                    >(
                      props: SelectProps<ValueType, OptionType>,
                    Severity: Major
                    Found in components/select/index.tsx - About 6 hrs to fix

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

                      import type { CSSInterpolation, CSSObject } from '@ant-design/cssinjs';
                      import { unit } from '@ant-design/cssinjs';
                      
                      import { genFocusStyle } from '../../style';
                      import type { GenerateStyle } from '../../theme/internal';
                      Severity: Minor
                      Found in components/button/style/index.ts - About 6 hrs to fix

                        Function InternalTooltip has 173 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const InternalTooltip = React.forwardRef<TooltipRef, TooltipProps>((props, ref) => {
                          const {
                            prefixCls: customizePrefixCls,
                            openClassName,
                            getTooltipContainer,
                        Severity: Major
                        Found in components/tooltip/index.tsx - About 6 hrs to fix

                          Function App has 173 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const App: React.FC = () => {
                            const [bordered, setBordered] = useState(false);
                            const [loading, setLoading] = useState(false);
                            const [size, setSize] = useState<SizeType>('large');
                            const [expandable, setExpandable] = useState<ExpandableConfig<DataType> | undefined>(
                          Severity: Major
                          Found in components/table/demo/dynamic-settings.tsx - About 6 hrs to fix

                            File Table.test.tsx has 450 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import React, { useRef } from 'react';
                            import { ConfigProvider } from 'antd';
                            
                            import type { TableProps, TableRef } from '..';
                            import Table from '..';
                            Severity: Minor
                            Found in components/table/__tests__/Table.test.tsx - About 6 hrs to fix

                              Function genTransferListStyle has 169 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const genTransferListStyle: GenerateStyle<TransferToken> = (token: TransferToken): CSSObject => {
                                const {
                                  componentCls,
                                  colorBorder,
                                  colorSplit,
                              Severity: Major
                              Found in components/transfer/style/index.ts - About 6 hrs to fix

                                File components.test.tsx has 447 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import React from 'react';
                                import dayjs from 'dayjs';
                                import customParseFormat from 'dayjs/plugin/customParseFormat';
                                
                                import ConfigProvider from '..';
                                Severity: Minor
                                Found in components/config-provider/__tests__/components.test.tsx - About 6 hrs to fix

                                  Function genFormItemStyle has 168 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const genFormItemStyle: GenerateStyle<FormToken> = (token) => {
                                    const {
                                      formItemCls,
                                      iconCls,
                                      componentCls,
                                  Severity: Major
                                  Found in components/form/style/index.ts - About 6 hrs to fix

                                    Function ColorPicker has 168 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    const ColorPicker: CompoundedComponent = (props) => {
                                      const {
                                        value,
                                        defaultValue,
                                        format,
                                    Severity: Major
                                    Found in components/color-picker/ColorPicker.tsx - About 6 hrs to fix

                                      File textarea.test.tsx has 444 lines of code (exceeds 250 allowed). Consider refactoring.
                                      Open

                                      import type { ChangeEventHandler, TextareaHTMLAttributes } from 'react';
                                      import React, { useState } from 'react';
                                      import { spyElementPrototypes } from 'rc-util/lib/test/domHook';
                                      
                                      import Input from '..';
                                      Severity: Minor
                                      Found in components/input/__tests__/textarea.test.tsx - About 6 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language