teableio/teable

View on GitHub

Showing 671 of 671 total issues

Function SpaceTrashPage has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

export const SpaceTrashPage = () => {
  const router = useRouter();
  const isHydrated = useIsHydrated();
  const queryClient = useQueryClient();
  const { t } = useTranslation(spaceConfig.i18nNamespaces);
Severity: Minor
Found in apps/nextjs-app/src/features/app/blocks/trash/SpaceTrashPage.tsx - About 2 hrs 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 FieldEditor has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

export const FieldEditor = (props: {
  isPrimary?: boolean;
  field: Partial<IFieldEditorRo>;
  operator: FieldOperator;
  onChange?: (field: IFieldEditorRo) => void;

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 trash.service.ts has 330 lines of code (exceeds 300 allowed). Consider refactoring.
Open

/* eslint-disable sonarjs/no-duplicate-string */
import {
  BadRequestException,
  ForbiddenException,
  Injectable,
Severity: Minor
Found in apps/nestjs-backend/src/features/trash/trash.service.ts - About 2 hrs to fix

    File QueryBuilder.tsx has 329 lines of code (exceeds 300 allowed). Consider refactoring.
    Open

    import { X } from '@teable/icons';
    import { BaseQueryColumnType, getFields } from '@teable/openapi';
    import type {
      IBaseQueryColumn,
      IBaseQuery,
    Severity: Minor
    Found in packages/sdk/src/components/base-query/QueryBuilder.tsx - About 2 hrs to fix

      Function SelectEditorMainBase has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      > = (props, ref) => {
        const {
          value: originValue,
          options = [],
          isMultiple,
      Severity: Minor
      Found in packages/sdk/src/components/editor/select/EditorMain.tsx - About 2 hrs 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 checkRegion has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

        checkRegion: (cell: ISelectCell, props: ICellClickProps, shouldCalculate?: boolean) => {
          const { data, displayData, readonly } = cell;
          const { width, isActive, hoverCellPosition, activeCellBound } = props;
          const editable = !readonly && isActive && activeCellBound;
          if (!editable) return { type: CellRegionType.Blank };

      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 FieldCreateOrSelectModal has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      >((props, forwardRef) => {
        const {
          title,
          description,
          content,

      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 updateLookupField has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

        private updateLookupField(field: IFieldInstance, fieldMap: IFieldMap): IOtOperation[] {
          const ops: (IOtOperation | undefined)[] = [];
          const lookupOptions = field.lookupOptions as ILookupOptionsVo;
          const linkField = fieldMap[lookupOptions.linkFieldId] as LinkFieldDto;
          const lookupField = fieldMap[lookupOptions.lookupFieldId];

      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 groupDbCollection2GroupPoints has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

        @Timing()
        // eslint-disable-next-line sonarjs/cognitive-complexity
        private async groupDbCollection2GroupPoints(
          groupResult: { [key: string]: unknown; __c: number }[],
          groupFields: IFieldInstance[],
      Severity: Minor
      Found in apps/nestjs-backend/src/features/record/record.service.ts - About 2 hrs 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 Guide has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      export const Guide = ({ user }: { user?: IUserMeVo }) => {
        const router = useRouter();
        const { t } = useTranslation(tableConfig.i18nNamespaces);
        const { completedGuideMap, setCompletedGuideMap } = useCompletedGuideMapStore();
      
      
      Severity: Minor
      Found in apps/nextjs-app/src/components/Guide.tsx - About 2 hrs 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

      File base.e2e-spec.ts has 323 lines of code (exceeds 300 allowed). Consider refactoring.
      Open

      import type { INestApplication } from '@nestjs/common';
      import { Role } from '@teable/core';
      import type {
        ICreateBaseVo,
        ICreateSpaceVo,
      Severity: Minor
      Found in apps/nestjs-backend/test/base.e2e-spec.ts - About 2 hrs to fix

        EventEmitterService has 23 functions (exceeds 20 allowed). Consider refactoring.
        Open

        @Injectable()
        export class EventEmitterService {
          private readonly logger = new Logger(EventEmitterService.name);
        
          private readonly eventNameMapping = {
        Severity: Minor
        Found in apps/nestjs-backend/src/event-emitter/event-emitter.service.ts - About 2 hrs to fix

          File visitor.ts has 319 lines of code (exceeds 300 allowed). Consider refactoring.
          Open

          /* eslint-disable @typescript-eslint/no-non-null-assertion */
          /* eslint-disable @typescript-eslint/no-explicit-any */
          import { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor';
          import { CellValueType } from '../models/field/constant';
          import type { FieldCore } from '../models/field/field';
          Severity: Minor
          Found in packages/core/src/formula/visitor.ts - About 2 hrs to fix

            Function Reaction has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            export const Reaction = (props: ICommentReactionProps) => {
              const { value, commentId } = props;
              const tableId = useTableId();
              const recordId = useRecordId();
              const { user: sessionUser } = useSession();

            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 BaseFieldValue has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            export function BaseFieldValue(props: IBaseFieldValue) {
              const { onSelect, components, field, operator, value, linkContext } = props;
              const { t } = useTranslation();
            
              const showEmptyComponent = useMemo(() => {

            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 replaceFieldIdsWithNames has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            function replaceFieldIdsWithNames(obj: any, fieldMap: { [fieldId: string]: { name: string } }) {
              if (typeof obj === 'object' && obj !== null) {
                for (const key in obj) {
                  // eslint-disable-next-line no-prototype-builtins
                  if (obj.hasOwnProperty(key)) {
            Severity: Minor
            Found in apps/nestjs-backend/src/features/calculation/utils/name-console.ts - About 2 hrs 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 updateLinkRecord has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

              private async updateLinkRecord(
                tableId: string,
                fkRecordMap: IFkRecordMap,
                fieldMapByTableId: { [tableId: string]: IFieldMap },
                originRecordMapByTableId: IRecordMapByTableId
            Severity: Minor
            Found in apps/nestjs-backend/src/features/calculation/link.service.ts - About 2 hrs 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 SignForm has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            export const SignForm: FC<ISignForm> = (props) => {
              const { className, type = 'signin', onSuccess } = props;
              const { t } = useTranslation(authConfig.i18nNamespaces);
            
              const [isLoading, setIsLoading] = useState<boolean>(false);
            Severity: Minor
            Found in apps/nextjs-app/src/features/auth/components/SignForm.tsx - About 2 hrs 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

            File chart.tsx has 317 lines of code (exceeds 300 allowed). Consider refactoring.
            Open

            'use client';
            
            import * as React from 'react';
            import * as RechartsPrimitive from 'recharts';
            
            
            Severity: Minor
            Found in packages/ui-lib/src/shadcn/ui/chart.tsx - About 2 hrs to fix

              File table-export.e2e-spec.ts has 317 lines of code (exceeds 300 allowed). Consider refactoring.
              Open

              /* eslint-disable sonarjs/no-duplicate-string */
              import fs from 'fs';
              import path from 'path';
              import type { INestApplication } from '@nestjs/common';
              import type { IFieldVo, IViewRo } from '@teable/core';
              Severity: Minor
              Found in apps/nestjs-backend/test/table-export.e2e-spec.ts - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language