alibaba/noform

View on GitHub

Showing 217 of 217 total issues

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

export const setSelectionsByInstance = (instance, ids, records) => {
  const targetInstance = instance.actions ? instance.actions : instance
  targetInstance.setRowSelection({
    ids,
    records
Severity: Major
Found in packages/next-components/src/shared.ts and 1 other location - About 1 hr to fix
packages/antd-components/src/shared.ts on lines 32..38

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

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

export const useLoading = (props: ITableProps = {}, propList?: IList): ILoadingHook => {
    const { multipleId: propsMultipleId } = props
    const list = propList || useContext(ListContext)
    const { id: contextMultipleId } = useContext(MultipleContext) || {}
    const multipleId = propsMultipleId || contextMultipleId
Severity: Minor
Found in packages/react/src/hooks/useLoading.ts - About 1 hr to fix

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

    const Preview = (props) => <p style={{ padding: 0, margin: 0, lineHeight: '28px' }} className="preview-text">
      {props.content}
    </p>
    Severity: Major
    Found in packages/antd/src/fields/index.tsx and 1 other location - About 1 hr to fix
    packages/next/src/fields/index.tsx on lines 60..62

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

    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 Preview = (props) => <p style={{ padding: 0, margin: 0, lineHeight: '28px' }} className="preview-text">
      {props.content}
    </p>
    Severity: Major
    Found in packages/next/src/fields/index.tsx and 1 other location - About 1 hr to fix
    packages/antd/src/fields/index.tsx on lines 54..56

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

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

    const InternalSorter = styled(forwardRef((props, ref) => {
        const { className, render,
            style,
            ascIcon = defaultAscIcon,
            descIcon = defaultDescIcon,
    Severity: Minor
    Found in packages/next-components/src/components/Sorter.tsx - About 1 hr to fix

      Function injectFuncs has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const injectFuncs = (props, funcs) => {
        if (!props) return props
        if (Array.isArray(props)) {
          return props.map(item => injectFuncs(item, funcs))
        } else if (typeof props === 'object') {
      Severity: Minor
      Found in packages/react-schema-renderer/src/index.tsx - About 1 hr to fix

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

        const ListExpandTrigger = createControllerBox('alist-expand-trigger', (props) => {
            const { schema } = props
            const componentProps = schema.getExtendsComponentProps()
            return <InternalExpandTrigger {...componentProps} />
        })
        Severity: Major
        Found in packages/next-components/src/components/ExpandTrigger.tsx and 1 other location - About 1 hr to fix
        packages/antd-components/src/components/ExpandTrigger.tsx on lines 26..30

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

        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 ListExpandTrigger = createControllerBox('alist-expand-trigger', (props) => {
            const { schema } = props
            const componentProps = schema.getExtendsComponentProps()
            return <InternalExpandTrigger {...componentProps} />
        })
        Severity: Major
        Found in packages/antd-components/src/components/ExpandTrigger.tsx and 1 other location - About 1 hr to fix
        packages/next-components/src/components/ExpandTrigger.tsx on lines 26..30

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

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

        const SchemaTable = (props) => {
            const { schema, children } = props
            const componentProps = schema.getExtendsComponentProps()
            const { columns, ...others } = componentProps
            if (columns) {
        Severity: Minor
        Found in packages/antd-components/src/components/Table.tsx - About 1 hr to fix

          Function SchemaTable has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const SchemaTable = (props) => {
              const { schema, children } = props
              const componentProps = schema.getExtendsComponentProps()
              const { columns, ...others } = componentProps
              if (columns) {
          Severity: Minor
          Found in packages/next-components/src/components/Table.tsx - About 1 hr to fix

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

            Layout = (() => {
                const LayoutExport: any = createVirtualBox('filter-flex-layout', CompatMegaLayout)
                LayoutExport.ButtonGroup = FormButtonGroup    
                LayoutExport.Grid = FormItemGrid
            
            
            Severity: Major
            Found in packages/next/src/components/Layout.tsx and 1 other location - About 1 hr to fix
            packages/antd/src/components/Layout.tsx on lines 22..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 56.

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

                  $('onFormMount').subscribe(state => {
                    lifeCycles.notify({
                      type: ListLifeCycleTypes.ON_LIST_FILTER_MOUNT,
                      ctx: listAPI,
                      payload: state
            Severity: Major
            Found in packages/core/src/index.ts and 2 other locations - About 1 hr to fix
            packages/core/src/index.ts on lines 513..519
            packages/core/src/index.ts on lines 522..528

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

            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 (needComputeColumnProps(subItem.props)) {
                                const cloneProps = computeColumnProps(subItem.props, { onSort })
                                return React.cloneElement(subItem, cloneProps)
                            } else {
                                return subItem
            Severity: Major
            Found in packages/next-components/src/components/Table.tsx and 1 other location - About 1 hr to fix
            packages/next-components/src/components/Table.tsx on lines 250..255

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

            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

            Layout = (() => {
                const LayoutExport: any = createVirtualBox('filter-flex-layout', CompatMegaLayout)
                LayoutExport.ButtonGroup = FormButtonGroup    
                LayoutExport.Grid = FormItemGrid
            
            
            Severity: Major
            Found in packages/antd/src/components/Layout.tsx and 1 other location - About 1 hr to fix
            packages/next/src/components/Layout.tsx on lines 22..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 56.

            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 (needComputeColumnProps(item.props)) {
                        const cloneProps = computeColumnProps(item.props, { onSort })
                        return React.cloneElement(item, cloneProps)
                    } else {
                        return item
            Severity: Major
            Found in packages/next-components/src/components/Table.tsx and 1 other location - About 1 hr to fix
            packages/next-components/src/components/Table.tsx on lines 240..245

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

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

                  $('onFieldValueChange').subscribe(state => {
                    lifeCycles.notify({
                      type: ListLifeCycleTypes.ON_LIST_FILTER_ITEM_CHANGE,
                      ctx: listAPI,
                      payload: state
            Severity: Major
            Found in packages/core/src/index.ts and 2 other locations - About 1 hr to fix
            packages/core/src/index.ts on lines 504..510
            packages/core/src/index.ts on lines 513..519

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

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

                  $('onFormValuesChange').subscribe(state => {
                    lifeCycles.notify({
                      type: ListLifeCycleTypes.ON_LIST_FILTER_VALUES_CHANGE,
                      ctx: listAPI,
                      payload: state
            Severity: Major
            Found in packages/core/src/index.ts and 2 other locations - About 1 hr to fix
            packages/core/src/index.ts on lines 504..510
            packages/core/src/index.ts on lines 522..528

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

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

            const MultipleProvider: React.FC<any> = (props = {}) => {
                const { children, hideWhen } = props
                const { list, id, pageSize } = useMultipleProvider(props)
            
                let element
            Severity: Minor
            Found in packages/react/src/components/MultipleProvider.tsx - About 1 hr to fix

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

                  useEffect(() => {
                      const id = list.subscribe(ListLifeCycleTypes.ON_LIST_CLEAR, clean)
                      return function cleanup() {
                          list.unSubscribe(id)
                      }
              Severity: Major
              Found in packages/react/src/components/FieldProvider.tsx and 3 other locations - About 1 hr to fix
              packages/react/src/components/FieldProvider.tsx on lines 52..57
              packages/react/src/hooks/useFilter.ts on lines 58..63
              packages/react/src/hooks/useFilterItem.ts on lines 31..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 55.

              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

                  useEffect(() => {
                      const id = list.subscribe(ListLifeCycleTypes.ON_LIST_FILTER_REFRESH, refresh)
                      return function cleanup() {
                          list.unSubscribe(id)
                      }
              Severity: Major
              Found in packages/react/src/hooks/useFilterItem.ts and 3 other locations - About 1 hr to fix
              packages/react/src/components/FieldProvider.tsx on lines 52..57
              packages/react/src/components/FieldProvider.tsx on lines 59..64
              packages/react/src/hooks/useFilter.ts on lines 58..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 55.

              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