teableio/teable

View on GitHub

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);
Severity: Minor
Found in packages/sdk/src/components/filter/hooks/useControllableState.ts - About 1 hr 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 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<
Severity: Minor
Found in packages/sdk/src/context/query/LinkFilterProvider.tsx - About 1 hr 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 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]);

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,

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,
Severity: Minor
Found in packages/sdk/src/components/expand-record/ExpandRecordHeader.tsx - About 1 hr 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 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',
Severity: Minor
Found in packages/openapi/src/generate.schema.ts - About 1 hr 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 prepareFormattingShowAs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  prepareFormattingShowAs(
    options: IFieldRo['options'] = {},
    sourceOptions: IFieldVo['options'],
    cellValueType: CellValueType,
    isMultipleCellValue?: boolean

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> =>
Severity: Minor
Found in packages/core/src/models/view/filter/filter-item.ts - About 1 hr 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 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> {

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

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

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 (
Severity: Minor
Found in apps/nextjs-app/src/features/app/blocks/view/kanban/utils/filter.ts - About 1 hr 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 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) {

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({
Severity: Minor
Found in apps/nextjs-app/src/features/app/blocks/share/view/AuthPage.tsx - About 1 hr 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 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]);

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 };
Severity: Minor
Found in apps/nestjs-backend/src/features/view/view.service.ts - About 1 hr 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 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,
Severity: Minor
Found in apps/nestjs-backend/src/features/view/view.service.ts - About 1 hr 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 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) => {
Severity: Minor
Found in apps/nestjs-backend/src/features/record/typecast.validate.ts - About 1 hr 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 SearchButton has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function SearchButton({
  className,
  textClassName,
}: {
  className?: string;

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

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

Severity
Category
Status
Source
Language