alibaba/noform

View on GitHub

Showing 77 of 217 total issues

Function createList has 589 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createList(props: IListProps = {}): IList {
  // 渲染相关的设置都在API层完成,core层只管数据,和操作数据的方法
  const list = new ListCore(props)
  const lifeCycles = new LifeCylcesCore({ lifeCycles: props.lifeCycles })

Severity: Major
Found in packages/core/src/index.ts - About 2 days to fix

    Function createList has a Cognitive Complexity of 112 (exceeds 5 allowed). Consider refactoring.
    Open

    function createList(props: IListProps = {}): IList {
      // 渲染相关的设置都在API层完成,core层只管数据,和操作数据的方法
      const list = new ListCore(props)
      const lifeCycles = new LifeCylcesCore({ lifeCycles: props.lifeCycles })
    
    
    Severity: Minor
    Found in packages/core/src/index.ts - About 2 days 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 index.ts has 613 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import ListCore from './model/core'
    import LifeCylcesCore, { ListLifeCycle } from './model/lifeCycles'
    import {
      IList,
      IListFunctionOptions,
    Severity: Major
    Found in packages/core/src/index.ts - About 1 day to fix

      Function useToggle has a Cognitive Complexity of 51 (exceeds 5 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: Minor
      Found in packages/react/src/hooks/useToggle.ts - About 7 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

      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

        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

          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

            File core.ts has 341 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import EventEmitter from 'events'
            import { ModeType, IListProps,
                IListState, IListFilterData, IListMultipleDataParams,
                IListSortConfig,
                IListMultipleData, IListMultiplePageSize, IListBaseResponse, IListKVMap,
            Severity: Minor
            Found in packages/core/src/model/core.ts - About 4 hrs to fix

              Function useAntdList has 99 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const useAntdList = (props: ITableProps = {}): ITableHook => {
                  const actionsRef = useRef<any>(null)
                  const reuseList = useContext(ListContext)
                  actionsRef.current = actionsRef.current || props.actions || reuseList || createAntdListActions()
              
              
              Severity: Major
              Found in packages/antd-components/src/hooks/useAntdList.ts - About 3 hrs to fix

                Function useNextList has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const useNextList = (props: ITableProps = {}): ITableHook => {
                    const actionsRef = useRef<any>(null)
                    const reuseList = useContext(ListContext)
                    actionsRef.current = actionsRef.current || props.actions || reuseList || createNextListActions()
                
                
                Severity: Major
                Found in packages/next-components/src/hooks/useNextList.ts - About 3 hrs to fix

                  File Table.tsx has 310 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import React, { forwardRef, useEffect, useContext } from 'react'
                  import { TableProvider, LoadingProvider, ListLifeCycleTypes, useToggle, ToggleContext, ListContext } from '@alist/react'
                  import { TableProps } from '@alifd/next/types/table'
                  import { IVirtualBoxProps, createVirtualBox, createControllerBox, FormExpressionScopeContext, complieExpression } from '@formily/next'
                  import { Table as NextTable, Loading } from '@alifd/next'
                  Severity: Minor
                  Found in packages/next-components/src/components/Table.tsx - About 3 hrs to fix

                    Function useAntdList has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const useAntdList = (props: ITableProps = {}): ITableHook => {
                        const actionsRef = useRef<any>(null)
                        const reuseList = useContext(ListContext)
                        actionsRef.current = actionsRef.current || props.actions || reuseList || createAntdListActions()
                    
                    
                    Severity: Major
                    Found in packages/antd/src/hooks/useAntdList.ts - About 3 hrs to fix

                      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

                        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

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

                              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
                                Severity
                                Category
                                Status
                                Source
                                Language