Showing 1,098 of 3,488 total issues
Function genBaseStyle
has 241 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const genBaseStyle: GenerateStyle<DropdownToken> = (token) => {
const {
componentCls,
menuCls,
zIndexPopup,
Function Base
has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring. Open
Open
const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => {
const {
prefixCls: customizePrefixCls,
className,
style,
- 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 Header
has 239 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Header: React.FC = () => {
const [locale, lang] = useLocale(locales);
const { pkg } = useSiteData();
File index.ts
has 563 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { unit } from '@ant-design/cssinjs';
import type { CSSObject } from '@ant-design/cssinjs';
import type { GenStyleFn } from 'antd/es/theme/util/genComponentStyleHook';
import {
Function getBaseStyle
has 237 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const getBaseStyle: GenerateStyle<MenuToken> = (token) => {
const {
antCls,
componentCls,
fontSize,
File Table.pagination.test.tsx
has 557 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import type { TablePaginationConfig, TableProps } from '..';
import Table from '..';
import scrollTo from '../../_util/scrollTo';
Function genInputGroupStyle
has 231 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const genInputGroupStyle = (token: InputToken): CSSObject => {
const { componentCls, antCls } = token;
return {
position: 'relative',
File index.tsx
has 551 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import * as React from 'react';
import { defaultAlgorithm, defaultTheme } from '@ant-design/compatible';
import {
BellOutlined,
FolderOutlined,
Function generateCalendar
has 228 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function generateCalendar<DateType extends AnyObject>(generateConfig: GenerateConfig<DateType>) {
function isSameYear(date1: DateType, date2: DateType) {
return date1 && date2 && generateConfig.getYear(date1) === generateConfig.getYear(date2);
}
File index.test.tsx
has 544 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-disable react/no-unstable-nested-components */
import React, { useEffect, useRef } from 'react';
import Tour from '..';
import mountTest from '../../../tests/shared/mountTest';
Function ColorStyle
has 225 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ColorStyle: React.FC = () => {
const token = useTheme();
const makePalette = (color: string, index: number = 1): string => {
if (index <= 10) {
File CodePreviewer.tsx
has 534 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { useContext, useEffect, useRef, useState } from 'react';
import { LinkOutlined, ThunderboltOutlined, UpOutlined } from '@ant-design/icons';
import type { Project } from '@stackblitz/sdk';
import stackblitzSdk from '@stackblitz/sdk';
import { Alert, Badge, Flex, Tooltip } from 'antd';
File dark.tsx
has 532 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// @ts-nocheck
import React, { useState } from 'react';
import { ClockCircleOutlined, DownOutlined } from '@ant-design/icons';
import {
Anchor,
Function genBaseStyle
has 217 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const genBaseStyle: GenerateStyle<ListToken> = (token) => {
const {
componentCls,
antCls,
controlHeight,
File tooltip.test.tsx
has 526 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import { spyElementPrototype } from 'rc-util/lib/test/domHook';
import type { TooltipPlacement } from '..';
import Tooltip from '..';
Function genSharedBadgeStyle
has 215 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const genSharedBadgeStyle: GenerateStyle<BadgeToken> = (token) => {
const {
componentCls,
iconCls,
antCls,
Function Anchor
has 213 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Anchor: React.FC<AnchorProps> = (props) => {
const {
rootClassName,
prefixCls: customPrefixCls,
className,
Function App
has 210 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const App: React.FC = () => {
const [bordered, setBordered] = useState(false);
const [loading, setLoading] = useState(false);
const [size, setSize] = useState<SizeType>('large');
const [expandable, setExpandable] = useState<ExpandableConfig<DataType> | undefined>(
Function Calendar
has 209 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Calendar = (props: CalendarProps<DateType>) => {
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
Function TransferList
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
Open
const TransferList = <RecordType extends KeyWiseTransferItem>(
props: TransferListProps<RecordType>,
) => {
const {
prefixCls,
- 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"