Showing 671 of 671 total issues
Function QueryBuilderContainer
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
>((props, ref) => {
const { className, query, onChange, depth = 0, getContextFromChild, maxDepth = 3 } = props;
const [fromType, setFromType] = useState<'table' | 'query' | undefined>();
const [childContext, setChildContext] = useState<IBaseQueryColumn[]>([]);
const [joinContext, setJoinContext] = useState<IContextColumns>([]);
- 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 deleteLinkOptionsDependenciesByFieldIds
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
async deleteLinkOptionsDependenciesByFieldIds(tableId: string, fieldIds: string[]) {
const foreignFields = await this.getLinkForeignFields(tableId);
const deletedFieldIdSet = new Set(fieldIds);
for (const field of foreignFields) {
- 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 exportCsvFromTable
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
async exportCsvFromTable(response: Response, tableId: string, viewId?: string) {
let count = 0;
let isOver = false;
const csvStream = new Readable({
// eslint-disable-next-line @typescript-eslint/no-empty-function
- 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 record-link-select-query.e2e-spec.ts
has 385 lines of code (exceeds 300 allowed). Consider refactoring. Open
/* eslint-disable sonarjs/cognitive-complexity */
/* eslint-disable @typescript-eslint/naming-convention */
import type { INestApplication } from '@nestjs/common';
import type { IFieldRo, IFieldVo } from '@teable/core';
import { FieldKeyType, FieldType, NumberFormattingType, Relationship } from '@teable/core';
File FieldMenu.tsx
has 385 lines of code (exceeds 300 allowed). Consider refactoring. Open
/* eslint-disable jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */
import type { IFilter, IGroup, ISort } from '@teable/core';
import { getValidFilterOperators } from '@teable/core';
import {
Trash,
File TableImport.tsx
has 382 lines of code (exceeds 300 allowed). Consider refactoring. Open
import { useMutation } from '@tanstack/react-query';
import type { ITimeZoneString } from '@teable/core';
import type {
IInplaceImportOptionRo,
IImportOptionRo,
File set-column-meta.e2e-spec.ts
has 380 lines of code (exceeds 300 allowed). Consider refactoring. Open
import type { INestApplication } from '@nestjs/common';
import type { IFieldVo, IFormColumnMeta, IGridColumnMeta } from '@teable/core';
import { StatisticsFunc, ViewType } from '@teable/core';
import type { ITableFullVo } from '@teable/openapi';
import { sortBy } from 'lodash';
Function expr
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public expr(_p?: number): ExprContext {
if (_p === undefined) {
_p = 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 useGPTRequest
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
export const useGPTRequest = () => {
const [isLoading, setIsLoading] = useState<boolean>(false);
// eslint-disable-next-line sonarjs/cognitive-complexity
const fetchChatGPTResponse = async (
messages: { role: CreatorRole; content: 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
LinkService
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
@Injectable()
export class LinkService {
constructor(
private readonly prismaService: PrismaService,
private readonly batchService: BatchService,
File space.e2e-spec.ts
has 374 lines of code (exceeds 300 allowed). Consider refactoring. Open
/* eslint-disable sonarjs/no-duplicate-string */
import type { INestApplication } from '@nestjs/common';
import { EventEmitter2 } from '@nestjs/event-emitter';
import { getPluginEmail, IdPrefix, Role } from '@teable/core';
import type {
File text.ts
has 373 lines of code (exceeds 300 allowed). Consider refactoring. Open
import { isNumber, isString } from 'lodash';
import { CellValueType } from '../../models/field/constant';
import type { TypedValue } from '../typed-value';
import { FormulaFunc, FormulaFuncType, FunctionName } from './common';
Function draw
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
draw: (cell: INumberCell, props: ICellRenderProps) => {
const { data, displayData, showAs, contentAlign = 'right' } = cell;
if (data == null || displayData == null || displayData === '') return;
- 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 LinkEditor
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
export const LinkEditor = (props: ILinkEditorProps) => {
const {
cellValue,
options,
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
File dashboard.service.ts
has 371 lines of code (exceeds 300 allowed). Consider refactoring. Open
/* eslint-disable sonarjs/no-duplicate-string */
import { Injectable, NotFoundException } from '@nestjs/common';
import type { IBaseRole } from '@teable/core';
import { generateDashboardId, generatePluginInstallId, Role } from '@teable/core';
import { PrismaService } from '@teable/db-main-prisma';
File sort.e2e-spec.ts
has 370 lines of code (exceeds 300 allowed). Consider refactoring. Open
/* eslint-disable sonarjs/no-duplicate-string */
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { INestApplication } from '@nestjs/common';
import type {
IDateFieldOptions,
File invitation.service.spec.ts
has 368 lines of code (exceeds 300 allowed). Consider refactoring. Open
/* eslint-disable @typescript-eslint/no-explicit-any */
import { BadRequestException, ForbiddenException, NotFoundException } from '@nestjs/common';
import type { TestingModule } from '@nestjs/testing';
import { Test } from '@nestjs/testing';
import { getPermissions, Role } from '@teable/core';
Function drawRoundPoly
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
export const drawRoundPoly = (ctx: CanvasRenderingContext2D, props: IRoundPolyProps) => {
const { points, radiusAll, fill, stroke } = props;
const asVec = function (p: IPoint, pp: IPoint): IVector {
const vx = pp.x - p.x;
const vy = pp.y - p.y;
- 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 drawSingleLineText
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
export const drawSingleLineText = (ctx: CanvasRenderingContext2D, props: ISingleLineTextProps) => {
const {
x = 0,
y = 0,
text,
- 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 CommentList
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
export const CommentList = forwardRef<CommentListRefHandle, ICommentListProps>((props, ref) => {
const { tableId, recordId, commentId } = props;
const { t } = useTranslation();
const collaborators = useCollaborators();
const listRef = useRef<HTMLDivElement>(null);
- 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"