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 })
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 })
- Read upRead up
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,
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
- Read upRead up
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[]
Function fetch
has 149 lines of code (exceeds 25 allowed). Consider refactoring. Open
const fetch = async (extraFilterData?: IListFilterData) => {
if (mode === ModeType.DATASOURCE) {
return
}
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: [
- Read upRead up
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
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,
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()
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()
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'
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()
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,
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 !== '*') {
- Read upRead up
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) || {}
- Read upRead up
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'
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))
Function RecursionTable
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
const RecursionTable = (props) => {
const { dataSource,
isLoop = false, loopProps = {},
isRoot,
loading,
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 !== '*') {