Showing 671 of 671 total issues
Function useControllableState
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function useControllableState<T>({ prop, defaultProp, onChange }: UseControllableStateParams<T>) {
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });
const isControlled = prop !== undefined;
const value = isControlled ? prop : uncontrolledProp;
const handleChange = useCallbackRef(onChange);
- 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 LinkFilterProvider
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const LinkFilterProvider: React.FC<ILinkFilterProviderProps> = (props) => {
const [filterLinkCellCandidate, setLinkCellCandidate] = useState<
[string, string] | string | undefined
>(props.filterLinkCellCandidate);
const [filterLinkCellSelected, setLinkCellSelected] = useState<
- 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 FilterUserSelectBase
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const FilterUserSelectBase = (props: IFilterUserBaseProps) => {
const { value, onSelect, operator, data, disableMe } = props;
const { user: currentUser } = useSession();
const { t } = useTranslation();
const values = useMemo<string | string[] | null>(() => value, [value]);
- 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 drawAvatar
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const drawAvatar = (ctx: CanvasRenderingContext2D, props: IAvatarProps) => {
const {
x,
y,
width,
- 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 ExpandRecordHeader
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const ExpandRecordHeader = (props: IExpandRecordHeader) => {
const {
tableId,
recordId,
title,
- 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 generateCodeSamples
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async function generateCodeSamples(document: OpenAPIObject) {
const routes = getRoutes();
const langs = ['shell', 'javascript_fetch', 'node', 'python'];
const targetTitle: Record<string, string> = {
shell: 'Shell',
- 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 prepareFormattingShowAs
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
prepareFormattingShowAs(
options: IFieldRo['options'] = {},
sourceOptions: IFieldVo['options'],
cellValueType: CellValueType,
isMultipleCellValue?: boolean
- 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 refineExtendedFilterOperatorSchema
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const refineExtendedFilterOperatorSchema = <
T extends z.infer<typeof filterOperatorRefineBase>,
>(
schema: z.ZodSchema<T>
): z.ZodSchema<T> =>
- 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 updateOptionsFromMultiSelectField
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private async updateOptionsFromMultiSelectField(
tableId: string,
updatedChoiceMap: { [old: string]: string | null },
field: MultipleSelectFieldDto
): Promise<IOpsMap | undefined> {
- 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 getGroupAdapter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private getGroupAdapter(field: IFieldInstance): Knex.QueryBuilder {
if (!field) return this.originQueryBuilder;
const { cellValueType, isMultipleCellValue, isStructuredCellValue } = field;
if (isMultipleCellValue) {
- 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 getNewFilterByFieldChanges
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
getNewFilterByFieldChanges(
originalFilter: IFilter,
newField: IFieldInstance,
oldField: IFieldInstance
) {
- 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 getFilterValue
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const getFilterValue = (stackField: IFieldInstance, stackData: unknown) => {
const { type, isMultipleCellValue, options } = stackField;
if (stackData == null) return stackData;
if (
- 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 parseLine
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
parseLine(line: string): IParsedLine | null {
const trimmedLine = line.endsWith(';') ? line.slice(0, -1) : line;
const tokens = trimmedLine.split(/(?<!\\)\|/).map((part) => part.replace(/\\\|/g, '|'));
console.log('line: ', line);
if (tokens.length !== 3) {
- 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 AuthPage
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const AuthPage = () => {
const [error, setError] = useState('');
const router = useRouter();
const shareId = router.query.shareId as string;
const { mutateAsync: authShareView, isLoading } = useMutation({
- 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 FieldConfigPanel
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const FieldConfigPanel = (props: IFieldConfigPanel) => {
const { onChange, workSheets, errorMessage } = props;
const { t } = useTranslation(['table']);
const [autoSelectTypes, setAutoSelectTypes] = useState<Record<string, boolean>>({});
const [selectedSheetKey, setSelectedSheetKey] = useState(Object.keys(workSheets)[0]);
- 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 update
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async update(version: number, tableId: string, viewId: string, opContexts: IViewOpContext[]) {
const userId = this.cls.get('user.id');
for (const opContext of opContexts) {
const updateData: Prisma.ViewUpdateInput = { version, lastModifiedBy: userId };
- 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 deleteViewRelativeByFields
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async deleteViewRelativeByFields(tableId: string, fieldIds: string[]) {
// 1. get all views id and column meta by tableId
const view = await this.prismaService.txClient().view.findMany({
select: {
columnMeta: true,
- 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 castToAttachment
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private async castToAttachment(cellValues: unknown[]): Promise<unknown[]> {
const attachmentItemsMap = this.typecast ? await this.getAttachmentItemMap(cellValues) : {};
const unsignedValues = this.mapFieldsCellValuesWithValidate(
cellValues,
(cellValue: unknown) => {
- 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 SearchButton
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function SearchButton({
className,
textClassName,
}: {
className?: string;
- 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 TableOperation
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const TableOperation = (props: ITableOperationProps) => {
const { table, className, onRename } = props;
const [deleteConfirm, setDeleteConfirm] = useState(false);
const [importVisible, setImportVisible] = useState(false);
const [importType, setImportType] = useState(SUPPORTEDTYPE.CSV);
- 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"