alibaba/noform

View on GitHub

Showing 217 of 217 total issues

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

export const registerListFuncs = (...args) => {
  if (args.length === 1) {
    Object.keys(args[0]).forEach(k => {
      if (args[0][k]) {
        globalFuncs[k] = args[0][k]
Severity: Major
Found in packages/react-schema-renderer/src/shared.tsx and 1 other location - About 4 hrs to fix
packages/react-schema-renderer/src/shared.tsx on lines 19..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 119.

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

export const registerListComponent = (...args) => {
  if (args.length === 1) {
    Object.keys(args[0]).forEach(k => {
      if (args[0][k]) {
        globalComponentsRegistry[k] = args[0][k]
Severity: Major
Found in packages/react-schema-renderer/src/shared.tsx and 1 other location - About 4 hrs to fix
packages/react-schema-renderer/src/shared.tsx on lines 31..41

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

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

File core.ts has 341 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import EventEmitter from 'events'
import { ModeType, IListProps,
    IListState, IListFilterData, IListMultipleDataParams,
    IListSortConfig,
    IListMultipleData, IListMultiplePageSize, IListBaseResponse, IListKVMap,
Severity: Minor
Found in packages/core/src/model/core.ts - About 4 hrs to fix

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

    const ListFilterSpy = (props) => {
        const settingRef = useRef(null)
        
        const { form } = props    
        const list = useContext(ListContext)
    Severity: Major
    Found in packages/next-components/src/components/List.tsx and 1 other location - About 4 hrs to fix
    packages/antd-components/src/components/List.tsx on lines 11..26

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

    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

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

    const ListFilterSpy = (props) => {
        const settingRef = useRef(null)
        
        const { form } = props    
        const list = useContext(ListContext)
    Severity: Major
    Found in packages/antd-components/src/components/List.tsx and 1 other location - About 4 hrs to fix
    packages/next-components/src/components/List.tsx on lines 11..26

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

    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

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

        const refresh = (opts) => {
            const { payload } = opts;
            const { notifyId } = payload || {}
            if (notifyId) {
                if (multipleId !== undefined) {
    Severity: Major
    Found in packages/react/src/hooks/useLoading.ts and 2 other locations - About 4 hrs to fix
    packages/react/src/hooks/usePagination.ts on lines 32..46
    packages/react/src/hooks/useTable.ts on lines 44..58

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

    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

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

        const refresh = (opts) => {        
            const { payload } = opts;
            const { notifyId } = payload || {}      
            if (notifyId) {
                if (multipleId !== undefined) {
    Severity: Major
    Found in packages/react/src/hooks/usePagination.ts and 2 other locations - About 4 hrs to fix
    packages/react/src/hooks/useLoading.ts on lines 16..30
    packages/react/src/hooks/useTable.ts on lines 44..58

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

    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

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

        const refresh = (opts) => {
            const { payload } = opts;
            const { notifyId } = payload || {}
            if (notifyId) {
                if (multipleId !== undefined) {
    Severity: Major
    Found in packages/react/src/hooks/useTable.ts and 2 other locations - About 4 hrs to fix
    packages/react/src/hooks/useLoading.ts on lines 16..30
    packages/react/src/hooks/usePagination.ts on lines 32..46

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

    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

    Function useAntdList has 99 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const useAntdList = (props: ITableProps = {}): ITableHook => {
        const actionsRef = useRef<any>(null)
        const reuseList = useContext(ListContext)
        actionsRef.current = actionsRef.current || props.actions || reuseList || createAntdListActions()
    
    
    Severity: Major
    Found in packages/antd-components/src/hooks/useAntdList.ts - About 3 hrs to fix

      Function useNextList has 98 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const useNextList = (props: ITableProps = {}): ITableHook => {
          const actionsRef = useRef<any>(null)
          const reuseList = useContext(ListContext)
          actionsRef.current = actionsRef.current || props.actions || reuseList || createNextListActions()
      
      
      Severity: Major
      Found in packages/next-components/src/hooks/useNextList.ts - About 3 hrs to fix

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

        function buildES5() {
          const rootNames = glob.sync(`${TEMP_OUT_DIR}/**/*.js`)
          compile(rootNames, {
            allowJs: true,
            esModuleInterop: true,
        Severity: Major
        Found in packages/next-components/build.ts and 3 other locations - About 3 hrs to fix
        packages/antd-components/build.ts on lines 39..51
        packages/antd/build.ts on lines 46..58
        packages/next/build.ts on lines 39..51

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

        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

        function buildES5() {
          const rootNames = glob.sync(`${TEMP_OUT_DIR}/**/*.js`)
          compile(rootNames, {
            allowJs: true,
            esModuleInterop: true,
        Severity: Major
        Found in packages/antd/build.ts and 3 other locations - About 3 hrs to fix
        packages/antd-components/build.ts on lines 39..51
        packages/next-components/build.ts on lines 39..51
        packages/next/build.ts on lines 39..51

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

        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

        function buildES5() {
          const rootNames = glob.sync(`${TEMP_OUT_DIR}/**/*.js`)
          compile(rootNames, {
            allowJs: true,
            esModuleInterop: true,
        Severity: Major
        Found in packages/antd-components/build.ts and 3 other locations - About 3 hrs to fix
        packages/antd/build.ts on lines 46..58
        packages/next-components/build.ts on lines 39..51
        packages/next/build.ts on lines 39..51

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

        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

        function buildES5() {
          const rootNames = glob.sync(`${TEMP_OUT_DIR}/**/*.js`)
          compile(rootNames, {
            allowJs: true,
            esModuleInterop: true,
        Severity: Major
        Found in packages/next/build.ts and 3 other locations - About 3 hrs to fix
        packages/antd-components/build.ts on lines 39..51
        packages/antd/build.ts on lines 46..58
        packages/next-components/build.ts on lines 39..51

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

        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

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

        import React, { forwardRef, useEffect, useContext } from 'react'
        import { TableProvider, LoadingProvider, ListLifeCycleTypes, useToggle, ToggleContext, ListContext } from '@alist/react'
        import { TableProps } from '@alifd/next/types/table'
        import { IVirtualBoxProps, createVirtualBox, createControllerBox, FormExpressionScopeContext, complieExpression } from '@formily/next'
        import { Table as NextTable, Loading } from '@alifd/next'
        Severity: Minor
        Found in packages/next-components/src/components/Table.tsx - About 3 hrs to fix

          Function useAntdList has 83 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const useAntdList = (props: ITableProps = {}): ITableHook => {
              const actionsRef = useRef<any>(null)
              const reuseList = useContext(ListContext)
              actionsRef.current = actionsRef.current || props.actions || reuseList || createAntdListActions()
          
          
          Severity: Major
          Found in packages/antd/src/hooks/useAntdList.ts - About 3 hrs to fix

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

                            <a className={`${order === 'asc' ? 'current' : ''}`}>
                                <i className={`next-icon alist-sorter asc `}
                                    onClick={() => {
                                        const nextOrder = setOrder('asc')
                                        onSort(props.dataIndex, nextOrder)
            Severity: Major
            Found in packages/next-components/src/components/Sorter.tsx and 1 other location - About 3 hrs to fix
            packages/next-components/src/components/Sorter.tsx on lines 32..39

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

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

                            <a className={`${order === 'desc' ? 'current' : ''}`}>
                            <i className={`next-icon alist-sorter desc  `}
                                onClick={() => {
                                    const nextOrder = setOrder('desc')
                                    onSort(props.dataIndex, nextOrder)
            Severity: Major
            Found in packages/next-components/src/components/Sorter.tsx and 1 other location - About 3 hrs to fix
            packages/next-components/src/components/Sorter.tsx on lines 24..31

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

            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

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

                    disableRowSelection: () => {
                        const { className = '' } = actionsRef.current.getTableProps()
                        actionsRef.current.setSelectionConfig(null)                
                        actionsRef.current.setTableProps({ // 刷新
                            className: className.replace(` ${hasRowSelectionCls}`, ''),
            Severity: Major
            Found in packages/antd/src/hooks/useAntdList.ts and 2 other locations - About 3 hrs to fix
            packages/antd-components/src/hooks/useAntdList.ts on lines 20..27
            packages/next-components/src/hooks/useNextList.ts on lines 20..27

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

            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

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

                    disableRowSelection: () => {
                        const { className = '' } = actionsRef.current.getTableProps()
                        actionsRef.current.setSelectionConfig(null)                
                        actionsRef.current.setTableProps({ // 刷新
                            className: className.replace(` ${hasRowSelectionCls}`, ''),
            Severity: Major
            Found in packages/antd-components/src/hooks/useAntdList.ts and 2 other locations - About 3 hrs to fix
            packages/antd/src/hooks/useAntdList.ts on lines 21..28
            packages/next-components/src/hooks/useNextList.ts on lines 20..27

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

            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

            Severity
            Category
            Status
            Source
            Language