alibaba/noform

View on GitHub

Showing 217 of 217 total issues

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/next-components/src/components/Search.tsx - About 2 hrs to fix

    Function FieldProvider has 53 lines of code (exceeds 25 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: Major
    Found in packages/react/src/components/FieldProvider.tsx - About 2 hrs to fix

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

      function buildESM() {
        const { fileNames, options } = getCompileConfig(require.resolve('./tsconfig.json'), {
          outDir: './esm',
          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 12..19
      packages/antd/build.ts on lines 12..19
      packages/next/build.ts on lines 12..19

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

      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 buildESM() {
        const { fileNames, options } = getCompileConfig(require.resolve('./tsconfig.json'), {
          outDir: './esm',
          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 12..19
      packages/next-components/build.ts on lines 12..19
      packages/next/build.ts on lines 12..19

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

      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 buildESM() {
        const { fileNames, options } = getCompileConfig(require.resolve('./tsconfig.json'), {
          outDir: './esm',
          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 12..19
      packages/antd/build.ts on lines 12..19
      packages/next-components/build.ts on lines 12..19

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

      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 buildESM() {
        const { fileNames, options } = getCompileConfig(require.resolve('./tsconfig.json'), {
          outDir: './esm',
          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 12..19
      packages/next-components/build.ts on lines 12..19
      packages/next/build.ts on lines 12..19

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

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

      const InternalTable: InternalTableType = props => {
          const { children, columns, ...others } = props
          const renderProps: any = {}
          if (children) {
              renderProps.children = React.Children.map(props.children, (item: any) => {
      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 usePagination has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      export const usePagination = (props: IPaginationProps = {}, propList?: IList): IPaginationHook => {
          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/usePagination.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 injectFuncs has a Cognitive Complexity of 16 (exceeds 5 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 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 SchemaSolver has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const SchemaSolver = props => {
        const {
          effects,
          actions,
          schema,
      Severity: Major
      Found in packages/react-schema-renderer/src/index.tsx - About 2 hrs to fix

        Function InternalTable has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const InternalTable: InternalTableType = props => {
            const { children, columns, ...others } = props
            const renderProps: any = {}
            if (children) {
                renderProps.children = React.Children.map(props.children, (item: any) => {
        Severity: Major
        Found in packages/antd-components/src/components/Table.tsx - About 2 hrs to fix

          Function useList has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const useList = (options: IListUIProps): IList & { actions: any } => {
              const optionsRef = useRef<IListUIProps>(options)
              const actionsRef = useRef<any>(options.actions)
              const listDomain = useContext(ListDomain)
              actionsRef.current = actionsRef.current || createListActions()
          Severity: Minor
          Found in packages/react/src/hooks/useList.ts - About 2 hrs to fix

            Function InternalTable has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const InternalTable: InternalTableType = props => {
                const { onSort = noop, onFilter = noop, ...others } = props
                const columns = React.Children.map(props.children, (item: any) => {
                    if (!item) return item
                    /* 处理嵌套类的情况 */
            Severity: Minor
            Found in packages/next-components/src/components/Table.tsx - About 2 hrs to fix

              Function useConsumer has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const useConsumer = (props: IConsumerProps, propsList?: IList): {
                  list: IList,
                  type: string,
                  state: any,
                  listDomain: ListDomain
              Severity: Minor
              Found in packages/react/src/hooks/useConsumer.ts - About 1 hr to fix

                Function setRowSelection has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        setRowSelection: (selectionConfig: IListSelectionConfig) => {
                            actionsRef.current.setSelectionConfig(selectionConfig)
                            const config = actionsRef.current.getSelectionConfig()                
                            const { className = '' } = actionsRef.current.getTableProps()
                            if (config) {                    
                Severity: Minor
                Found in packages/antd-components/src/hooks/useAntdList.ts - About 1 hr to fix

                  Function setRowSelection has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          setRowSelection: (selectionConfig: IListSelectionConfig) => {
                              actionsRef.current.setSelectionConfig(selectionConfig)
                              const config = actionsRef.current.getSelectionConfig()                
                              const { className = '' } = actionsRef.current.getTableProps()
                              if (config) {                    
                  Severity: Minor
                  Found in packages/antd/src/hooks/useAntdList.ts - About 1 hr to fix

                    Function getFilterEffects has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const getFilterEffects = props => {
                        const noop = () => {}
                        const { effects = noop } = props || {}
                        return ($, actions) => {
                          // 搜索区域初始化完成
                    Severity: Minor
                    Found in packages/core/src/index.ts - About 1 hr to fix

                      Function renderSchema has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const renderSchema = (props, contextProps) => {
                        const { effects, actions, funcRegistry, componentsRegistry } = contextProps
                        const { children, componentName, props: componentProps } = props
                      
                        const schemaResult = {
                      Severity: Minor
                      Found in packages/react-schema-renderer/src/index.tsx - About 1 hr 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 useLoading has a Cognitive Complexity of 15 (exceeds 5 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

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

                              setRowSelection: (selectionConfig: IListSelectionConfig) => {
                                  actionsRef.current.setSelectionConfig(selectionConfig)
                                  const config = actionsRef.current.getSelectionConfig()
                                  const { className = '', primaryKey: defaultPrimaryKey } = actionsRef.current.getTableProps()
                                  if (config) {                    
                      Severity: Minor
                      Found in packages/next-components/src/hooks/useNextList.ts - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language