alibaba/noform

View on GitHub

Showing 217 of 217 total issues

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

    return {
        actions,
        dataSource, url, method, params, pageSize, currentPage,
        total, autoLoad, defaultFilterValues, multiple,
        filterConfig, query, 
Severity: Major
Found in packages/react/src/utils/index.ts and 1 other location - About 2 hrs to fix
packages/react/src/utils/index.ts on lines 5..12

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

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

function buildTempESM() {
  const { fileNames, options } = getCompileConfig(require.resolve('./tsconfig.json'), {
    outDir: TEMP_OUT_DIR,
    module: ts.ModuleKind.ESNext
  })
Severity: Major
Found in packages/next/build.ts and 3 other locations - About 2 hrs to fix
packages/antd-components/build.ts on lines 23..31
packages/antd/build.ts on lines 24..32
packages/next-components/build.ts on lines 23..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 86.

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 {
        actions,
        dataSource, url, method, params, pageSize, currentPage,
        total, autoLoad, defaultFilterValues, multiple,
        filterConfig, query, 
Severity: Major
Found in packages/react/src/utils/index.ts and 1 other location - About 2 hrs to fix
packages/react/src/utils/index.ts on lines 13..20

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

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 VirtualList = (props) => {
    const { form, children, schema } = props
    const componentProps = schema.getExtendsComponentProps()

    return <InternalList {...componentProps}>
Severity: Major
Found in packages/antd-components/src/components/List.tsx and 1 other location - About 2 hrs to fix
packages/next-components/src/components/List.tsx on lines 28..36

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

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 VirtualList = (props) => {
    const { form, children, schema } = props
    const componentProps = schema.getExtendsComponentProps()

    return <InternalList {...componentProps}>
Severity: Major
Found in packages/next-components/src/components/List.tsx and 1 other location - About 2 hrs to fix
packages/antd-components/src/components/List.tsx on lines 29..37

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

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

function buildTempESM() {
  const { fileNames, options } = getCompileConfig(require.resolve('./tsconfig.json'), {
    outDir: TEMP_OUT_DIR,
    module: ts.ModuleKind.ESNext
  })
Severity: Major
Found in packages/antd/build.ts and 3 other locations - About 2 hrs to fix
packages/antd-components/build.ts on lines 23..31
packages/next-components/build.ts on lines 23..31
packages/next/build.ts on lines 23..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 86.

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 271 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { forwardRef, useContext, useEffect } from 'react'
import { LoadingProvider, TableProvider, ListLifeCycleTypes, useToggle, ToggleContext, ListContext } from '@alist/react'
import { Table as AntdTable, Spin } from 'antd'
import { TableProps, ColumnProps } from 'antd/lib/table'
import { ColumnGroupProps } from 'antd/lib/table/ColumnGroup'
Severity: Minor
Found in packages/antd-components/src/components/Table.tsx - About 2 hrs to fix

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

          $('onFormSubmitValidateSuccess').subscribe(state => {
            const { errors, warnings } = state
            lifeCycles.notify({
              type: ListLifeCycleTypes.ON_LIST_VALIDATE_END,
              ctx: listAPI,
    Severity: Major
    Found in packages/core/src/index.ts and 1 other location - About 2 hrs to fix
    packages/core/src/index.ts on lines 539..546

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

    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

          $('onFormSubmitValidateFailed').subscribe(state => {
            const { errors, warnings } = state
            lifeCycles.notify({
              type: ListLifeCycleTypes.ON_LIST_VALIDATE_END,
              ctx: listAPI,
    Severity: Major
    Found in packages/core/src/index.ts and 1 other location - About 2 hrs to fix
    packages/core/src/index.ts on lines 549..556

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

    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 Toggle has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Toggle = (props) => {
        const { id, children, ...others } = props
        const { list, state }= useConsumer({
            ...others,
            selector: [
    Severity: Major
    Found in packages/react/src/components/Toggle.tsx - About 2 hrs to fix

      Function FieldProvider has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      const FieldProvider: React.FC<any> = (props = {}) => {
          const { children, name, connectMode = false, defaultEmptyValue = null, searchOnChange = false } = props
          const list = useContext(ListContext)
          const { mode } = useContext(FilterModeContext) || {}
          const formatName = getFormatName(name)
      Severity: Minor
      Found in packages/react/src/components/FieldProvider.tsx - About 2 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 constructor has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          constructor(...params: any[]) {
              super()
              
              this.id = 'rd_' + `${Math.random()}`.slice(2)
              if (params.length === 2) {
      Severity: Minor
      Found in packages/core/src/model/lifeCycles.ts - About 2 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 useTable has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const useTable = (props: ITableProps = {}, propList?: IList): ITableHook => {
          const { pickInitialTableProps, multipleId: propsMultipleId } = props
          const list = propList || useContext(ListContext)
          const { id: contextMultipleId } = useContext(MultipleContext) || {}
          const listProps = useContext(ListPropsContext) || {}
      Severity: Major
      Found in packages/react/src/hooks/useTable.ts - About 2 hrs to fix

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

        const MultipleProvider = createControllerBox('alist-multipleProvider', (props) => {
            const { form, schema, children } = props
            const componentProps = schema.getExtendsComponentProps()
            return <InternalMultipleProvider {...componentProps} form={form}>
                {children}
        Severity: Major
        Found in packages/antd-components/src/components/MultipleProvider.tsx and 1 other location - About 2 hrs to fix
        packages/next-components/src/components/MultipleProvider.tsx on lines 5..11

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

        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 MultipleProvider = createControllerBox('alist-multipleProvider', (props) => {
            const { form, schema, children } = props
            const componentProps = schema.getExtendsComponentProps()
            return <InternalMultipleProvider {...componentProps} form={form}>
                {children}
        Severity: Major
        Found in packages/next-components/src/components/MultipleProvider.tsx and 1 other location - About 2 hrs to fix
        packages/antd-components/src/components/MultipleProvider.tsx on lines 5..11

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

        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 a Cognitive Complexity of 17 (exceeds 5 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: Minor
        Found in packages/antd-components/src/hooks/useAntdList.ts - About 2 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

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

        registerListComponent({
          FormSlot,
          List,
          Table,
          Filter,
        Severity: Major
        Found in packages/next/src/index.ts and 1 other location - About 2 hrs to fix
        packages/antd/src/index.ts on lines 31..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 80.

        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

        registerListComponent({
          FormSlot,
          List,
          Table,
          Filter,
        Severity: Major
        Found in packages/antd/src/index.ts and 1 other location - About 2 hrs to fix
        packages/next/src/index.ts on lines 32..47

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

        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 useFilter has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const useFilter = (props: IFilterProps, propsList?: IList): IFilterHook => {
            const filterRef = useRef(props.form || null)
            const { useForm, effects, mirror } = props
            const list = propsList || useContext(ListContext)
            const filterProps = list.getFilterProps()
        Severity: Major
        Found in packages/react/src/hooks/useFilter.ts - About 2 hrs to fix

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

          const InternalSearch = (props) => {
              const { form, enableLoading, render, content, children, ...others } = props
              return <Consumer
                  form={form}
                  reducer={(state, action) => {
          Severity: Major
          Found in packages/antd-components/src/components/Search.tsx - About 2 hrs to fix
            Severity
            Category
            Status
            Source
            Language