alibaba/noform

View on GitHub

Showing 217 of 217 total issues

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

const Filter: any = styled(forwardRef((props, ref) => {
    const { mode = 'schema', children, effects, mirror, ...others } = props
    return <FilterProvider
        mirror={mirror}
        mode={mode}
Severity: Major
Found in packages/next/src/components/Filter.tsx and 1 other location - About 6 hrs to fix
packages/antd/src/components/Filter.tsx on lines 72..103

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

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

const Filter: any = styled(forwardRef(((props, ref) => {
    const { mode = 'schema', children, effects, mirror, ...others } = props
    return <FilterProvider mirror={mirror} mode={mode} {...others} useForm={useForm} effects={effects}>
        {(connectProps) => {
            const { filterInstance } = connectProps
Severity: Major
Found in packages/antd/src/components/Filter.tsx and 1 other location - About 6 hrs to fix
packages/next/src/components/Filter.tsx on lines 74..100

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

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

ListCore has 47 functions (exceeds 20 allowed). Consider refactoring.
Open

export default class ListCore extends EventEmitter {
    // 优先级:本地dataSource > url > 自定义query
    private state: IListState
    filterInstance: any
    mirrorFilterInstance: any[]
Severity: Minor
Found in packages/core/src/model/core.ts - About 6 hrs to fix

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

            getRowSelection: () => {
                const selectionConfig = actionsRef.current.getSelectionConfig()        
                let config = null
                if (selectionConfig) {
                    const dataSource = actionsRef.current.getPaginationDataSource()
    Severity: Major
    Found in packages/antd-components/src/hooks/useAntdList.ts and 1 other location - About 6 hrs to fix
    packages/next-components/src/hooks/useNextList.ts on lines 28..44

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

    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

            getRowSelection: () => {
                const selectionConfig = actionsRef.current.getSelectionConfig()        
                let config = null
                if (selectionConfig) {
                    const dataSource = actionsRef.current.getPaginationDataSource()
    Severity: Major
    Found in packages/next-components/src/hooks/useNextList.ts and 1 other location - About 6 hrs to fix
    packages/antd-components/src/hooks/useAntdList.ts on lines 28..44

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

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

      const fetch = async (extraFilterData?: IListFilterData) => {
        if (mode === ModeType.DATASOURCE) {
          return
        }
    
    
    Severity: Major
    Found in packages/core/src/index.ts - About 5 hrs to fix

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

      const ToggleActionText = styled(forwardRef((props, ref) => {
          return <div className={props.className} ref={ref}>
              <div className="alist-toggle-action-text">{props.children}</div>
          </div>
      }))`
      Severity: Major
      Found in packages/antd-components/src/components/ToggleTrigger.tsx and 1 other location - About 5 hrs to fix
      packages/next-components/src/components/ToggleTrigger.tsx on lines 10..24

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

      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 ToggleActionText = styled(forwardRef((props, ref) => {
          return <div className={props.className} ref={ref}>
              <div className="alist-toggle-action-text">{props.children}</div>
          </div>
      }))`
      Severity: Major
      Found in packages/next-components/src/components/ToggleTrigger.tsx and 1 other location - About 5 hrs to fix
      packages/antd-components/src/components/ToggleTrigger.tsx on lines 10..24

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

      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 InternalSelection = (props) => {
          const { children, render, ...others } = props
          const compatChildren = render || children
          return <Selection {...others}>
              {(opts, list) => {
      Severity: Major
      Found in packages/antd-components/src/components/Selection.tsx and 1 other location - About 5 hrs to fix
      packages/next-components/src/components/Selection.tsx on lines 6..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 152.

      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 InternalSelection = (props) => {
          const { children, render, ...others } = props
          const compatChildren = render || children
          return <Selection {...others}>
              {(opts, list) => {
      Severity: Major
      Found in packages/next-components/src/components/Selection.tsx and 1 other location - About 5 hrs to fix
      packages/antd-components/src/components/Selection.tsx on lines 6..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 152.

      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

          if (list) {
              // 第一次会进入这里       
              if (list.getAllColumns().length === 0) {
                  if (columns) {
                      list.setAllColumns(columns)
      Severity: Major
      Found in packages/antd-components/src/components/Table.tsx and 1 other location - About 5 hrs to fix
      packages/next-components/src/components/Table.tsx on lines 61..76

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

      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

          if (list) {
              // 第一次会进入这里
              if (list.getAllColumns().length === 0) {
                  if (columns) {
                      list.setAllColumns(columns)
      Severity: Major
      Found in packages/next-components/src/components/Table.tsx and 1 other location - About 5 hrs to fix
      packages/antd-components/src/components/Table.tsx on lines 43..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 148.

      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

        const reset = (fnOpts?: IListFunctionOptions) => {
          // 生命周期:清理查询条件
          lifeCycles.notify({
            type: ListLifeCycleTypes.ON_LIST_RESET,
            ctx: listAPI
      Severity: Major
      Found in packages/core/src/index.ts and 1 other location - About 5 hrs to fix
      packages/core/src/index.ts on lines 280..296

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

      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

        const clear = (fnOpts?: IListFunctionOptions) => {
          // 生命周期:清理查询条件
          lifeCycles.notify({
            type: ListLifeCycleTypes.ON_LIST_CLEAR,
            ctx: listAPI
      Severity: Major
      Found in packages/core/src/index.ts and 1 other location - About 5 hrs to fix
      packages/core/src/index.ts on lines 299..317

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

      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 a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

      const Toggle = (props) => {
          const { id, children, ...others } = props
          const { list, state }= useConsumer({
              ...others,
              selector: [
      Severity: Minor
      Found in packages/react/src/components/Toggle.tsx - About 4 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 useToggle has 114 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const useToggle = (props) => {
          const { defaultOpen, defaultOpenAll, toggleeKey, multipleId: propsMultipleId } = props
          const { list, tableProps } = useContext(TableContext)
          const { id: contextMultipleId } = useContext(MultipleContext) || {}
          const multipleId = propsMultipleId || contextMultipleId
      Severity: Major
      Found in packages/react/src/hooks/useToggle.ts - About 4 hrs to fix

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

        const alias = packages
          .map(v => path.join(packagesDir, v))
          .filter(v => {
            return !fs.statSync(v).isFile()
          })
        Severity: Major
        Found in scripts/jest.base.js and 1 other location - About 4 hrs to fix
        scripts/docs.js on lines 31..43

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

        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 alias = packages
            .map(v => path.join(packagesDir, v))
            .filter(v => {
              return !fs.statSync(v).isFile()
            })
        Severity: Major
        Found in scripts/docs.js and 1 other location - About 4 hrs to fix
        scripts/jest.base.js on lines 5..16

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

        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

                if (multipleId !== undefined) {
                    const multipleData = list.getMultipleData()
                    const { paginationDataList } = multipleData[multipleId] as IListKVMap<IListResponse> || {}
                    dataSource = paginationDataList as any [] || []
                } else {
        Severity: Major
        Found in packages/react/src/hooks/useToggle.ts and 1 other location - About 4 hrs to fix
        packages/react/src/hooks/useTable.ts 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

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

            if (multipleId !== undefined) {
                const multipleData = list.getMultipleData()
                const { paginationDataList } = multipleData[multipleId] as IListKVMap<IListResponse> || {}
                dataSource = paginationDataList as any [] || []
            } else {
        Severity: Major
        Found in packages/react/src/hooks/useTable.ts and 1 other location - About 4 hrs to fix
        packages/react/src/hooks/useToggle.ts on lines 23..33

        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

        Severity
        Category
        Status
        Source
        Language