alibaba/noform

View on GitHub

Showing 217 of 217 total issues

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/next-components/src/hooks/useNextList.ts and 2 other locations - About 3 hrs to fix
packages/antd-components/src/hooks/useAntdList.ts on lines 20..27
packages/antd/src/hooks/useAntdList.ts on lines 21..28

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

Function RecursionTable has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const RecursionTable = (props) => {
    const { dataSource,
        hasExpandedRowCtrl = true, expandedRowIndent,
        isLoop = false, loopProps = {},
        isRoot,
Severity: Major
Found in packages/next-components/src/components/Table.tsx - About 3 hrs to fix

    Function validateMessage has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    var validateMessage = function(raw) {
      var types = (config.types = config.types || 'conventional-commit-types')
    
      // resolve types from a module
      if (typeof types === 'string' && types !== '*') {
    Severity: Minor
    Found in scripts/validate-commit-msg.js - About 3 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

                return <StyledBtn type="link" {...others} onClick={id ? toggle : () => {
                    toggleAll(expandedAllStatus)
                }}>
                    <ToggleActionText color={color} fontSize={fontSize}>
                        {children}
    Severity: Major
    Found in packages/antd-components/src/components/ToggleTrigger.tsx and 1 other location - About 3 hrs to fix
    packages/next-components/src/components/ToggleTrigger.tsx on lines 38..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 95.

    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

                return <Button type="primary" text {...others} onClick={id ? toggle : () => {
                    toggleAll(expandedAllStatus)
                }}>
                    <ToggleActionText color={color} fontSize={fontSize}>
                        {children}
    Severity: Major
    Found in packages/next-components/src/components/ToggleTrigger.tsx and 1 other location - About 3 hrs to fix
    packages/antd-components/src/components/ToggleTrigger.tsx on lines 45..54

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

    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 useTable has a Cognitive Complexity of 21 (exceeds 5 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: Minor
    Found in packages/react/src/hooks/useTable.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

    File types.ts has 286 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { ListLifeCycle } from './model/lifeCycles'
    
    // 常量
    export type IListQueryMethod = 'GET' | 'POST'
    export type IListQuerySort = 'desc' | 'asc'
    Severity: Minor
    Found in packages/core/src/types.ts - About 2 hrs to fix

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

          expect(multipleData).toEqual({
            "list1":  {
              "currentPage": 1,
              "dataList": [],
              "pageSize": 10,
      Severity: Major
      Found in packages/core/src/__tests__/core.spec.ts and 1 other location - About 2 hrs to fix
      packages/core/src/__tests__/index.spec.ts on lines 143..160

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

      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

          expect(multipleData).toEqual({
            "list1":  {
              "currentPage": 1,
              "dataList": [],
              "pageSize": 10,
      Severity: Major
      Found in packages/core/src/__tests__/index.spec.ts and 1 other location - About 2 hrs to fix
      packages/core/src/__tests__/core.spec.ts on lines 110..127

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

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

      const createDocs = async () => {
        const packagesDir = path.resolve(process.cwd(), './packages')
        const packages = await fs.readdir(packagesDir)
        const alias = packages
          .map(v => path.join(packagesDir, v))
      Severity: Major
      Found in scripts/docs.js - About 2 hrs to fix

        Function validateMessage has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var validateMessage = function(raw) {
          var types = (config.types = config.types || 'conventional-commit-types')
        
          // resolve types from a module
          if (typeof types === 'string' && types !== '*') {
        Severity: Major
        Found in scripts/validate-commit-msg.js - About 2 hrs to fix

          Function RecursionTable has 67 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const RecursionTable = (props) => {
              const { dataSource,
                  isLoop = false, loopProps = {},
                  isRoot,
                  loading,
          Severity: Major
          Found in packages/antd-components/src/components/Table.tsx - About 2 hrs to fix

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

                return <Consumer
                    form={form}
                    reducer={(state, action) => {
                        switch (action.type) {
                            case ListLifeCycleTypes.ON_LIST_BEFORE_QUERY:
            Severity: Major
            Found in packages/antd-components/src/components/Search.tsx and 1 other location - About 2 hrs to fix
            packages/next-components/src/components/Search.tsx on lines 9..63

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

            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

                return <Consumer
                    form={form}
                    reducer={(state, action) => {
                        switch (action.type) {
                            case ListLifeCycleTypes.ON_LIST_BEFORE_QUERY:
            Severity: Major
            Found in packages/next-components/src/components/Search.tsx and 1 other location - About 2 hrs to fix
            packages/antd-components/src/components/Search.tsx on lines 9..63

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

            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 setMultipleData = (
                multipleData: IListMultipleDataParams,
                fnOpts?: IListFunctionOptions
              ) => {
                const multipleKeys = Object.keys(multipleData)
            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 408..419

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

            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 setMultiplePageSize = (
                multiplePageSize: IListMultiplePageSize,
                fnOpts?: IListFunctionOptions
              ) => {
                const multipleKeys = Object.keys(multiplePageSize)
            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 394..405

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

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

            const RecursionTable = (props) => {
                const { dataSource,
                    isLoop = false, loopProps = {},
                    isRoot,
                    loading,
            Severity: Minor
            Found in packages/antd-components/src/components/Table.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 RecursionTable has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            const RecursionTable = (props) => {
                const { dataSource,
                    hasExpandedRowCtrl = true, expandedRowIndent,
                    isLoop = false, loopProps = {},
                    isRoot,
            Severity: Minor
            Found in packages/next-components/src/components/Table.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

            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-components/build.ts and 3 other locations - About 2 hrs to fix
            packages/antd/build.ts on lines 24..32
            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

            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-components/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/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

            Severity
            Category
            Status
            Source
            Language