teableio/teable

View on GitHub

Showing 671 of 671 total issues

Function ExpandRecord has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

export const ExpandRecord = (props: IExpandRecordProps) => {
  const {
    model,
    visible,
    recordId,
Severity: Minor
Found in packages/sdk/src/components/expand-record/ExpandRecord.tsx - About 3 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 view.e2e-spec.ts has 360 lines of code (exceeds 300 allowed). Consider refactoring.
Open

/* eslint-disable sonarjs/no-duplicate-string */
import type { INestApplication } from '@nestjs/common';
import type { IColumn, IFieldRo, IFieldVo, IViewRo } from '@teable/core';
import { FieldKeyType, FieldType, Relationship, ViewType } from '@teable/core';
import type { ICreateTableRo, ITableFullVo } from '@teable/openapi';
Severity: Minor
Found in apps/nestjs-backend/test/view.e2e-spec.ts - About 3 hrs to fix

    Function genColumns has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      async genColumns() {
        const supportTypes = Importer.SUPPORTEDTYPE;
        const parseResult = await this.parse();
        const { fileName, type } = this.config;
        const result: IAnalyzeVo['worksheets'] = {};
    Severity: Minor
    Found in apps/nestjs-backend/src/features/import/open-api/import.class.ts - About 3 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 FormulaEditor has 360 lines of code (exceeds 300 allowed). Consider refactoring.
    Open

    export const FormulaEditor: FC<IFormulaEditorProps> = (props) => {
      const { expression, onConfirm } = props;
      const fields = useFields({ withHidden: true, withDenied: true });
      const { resolvedTheme } = useTheme();
      const { t } = useTranslation();
    Severity: Major
    Found in packages/sdk/src/components/editor/formula/Editor.tsx - About 3 hrs to fix

      CoordinateManager has 28 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export class CoordinateManager implements ICoordinate {
        protected defaultRowHeight: number;
        protected defaultColumnWidth: number;
        public pureRowCount: number;
        public rowCount: number;

        SelectionService has 28 functions (exceeds 20 allowed). Consider refactoring.
        Open

        @Injectable()
        export class SelectionService {
          constructor(
            private readonly recordService: RecordService,
            private readonly fieldService: FieldService,
        Severity: Minor
        Found in apps/nestjs-backend/src/features/selection/selection.service.ts - About 3 hrs to fix

          File base.service.ts has 355 lines of code (exceeds 300 allowed). Consider refactoring.
          Open

          import { ForbiddenException, Injectable, Logger, NotFoundException } from '@nestjs/common';
          import type { IRole } from '@teable/core';
          import { ActionPrefix, actionPrefixMap, generateBaseId, isUnrestrictedRole } from '@teable/core';
          import { PrismaService } from '@teable/db-main-prisma';
          import { CollaboratorType, ResourceType } from '@teable/openapi';
          Severity: Minor
          Found in apps/nestjs-backend/src/features/base/base.service.ts - About 3 hrs to fix

            Function FormulaOptionsInner has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

            export const FormulaOptionsInner = (props: {
              options: Partial<IFormulaFieldOptions> | undefined;
              onChange?: (options: Partial<IFormulaFieldOptions>) => void;
            }) => {
              const { options = {}, onChange } = props;

            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 field.schema.ts has 349 lines of code (exceeds 300 allowed). Consider refactoring.
            Open

            import type { RefinementCtx } from 'zod';
            import { assertNever } from '../../asserts';
            import type { IEnsureKeysMatchInterface } from '../../types';
            import { IdPrefix } from '../../utils';
            import { z } from '../../zod';
            Severity: Minor
            Found in packages/core/src/models/field/field.schema.ts - About 3 hrs to fix

              SqliteProvider has 27 functions (exceeds 20 allowed). Consider refactoring.
              Open

              export class SqliteProvider implements IDbProvider {
                private readonly logger = new Logger(SqliteProvider.name);
              
                constructor(private readonly knex: Knex) {}
              
              
              Severity: Minor
              Found in apps/nestjs-backend/src/db-provider/sqlite.provider.ts - About 3 hrs to fix

                PostgresProvider has 27 functions (exceeds 20 allowed). Consider refactoring.
                Open

                export class PostgresProvider implements IDbProvider {
                  private readonly logger = new Logger(PostgresProvider.name);
                  constructor(private readonly knex: Knex) {}
                
                  driver = DriverClient.Pg;
                Severity: Minor
                Found in apps/nestjs-backend/src/db-provider/postgres.provider.ts - About 3 hrs to fix

                  FieldService has 27 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  @Injectable()
                  export class FieldService implements IReadonlyAdapterService {
                    constructor(
                      private readonly batchService: BatchService,
                      private readonly prismaService: PrismaService,
                  Severity: Minor
                  Found in apps/nestjs-backend/src/features/field/field.service.ts - About 3 hrs to fix

                    ViewOpenApiService has 27 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    @Injectable()
                    export class ViewOpenApiService {
                      private logger = new Logger(ViewOpenApiService.name);
                    
                      constructor(

                      File typecast.validate.ts has 348 lines of code (exceeds 300 allowed). Consider refactoring.
                      Open

                      import { BadRequestException } from '@nestjs/common';
                      import type {
                        IAttachmentCellValue,
                        IAttachmentItem,
                        ILinkCellValue,
                      Severity: Minor
                      Found in apps/nestjs-backend/src/features/record/typecast.validate.ts - About 3 hrs to fix

                        Function GridViewBase has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export const GridViewBase = (props: IGridViewProps) => {
                          const { groupPointsServerData } = props;
                          const view = useView();
                          const tableId = useTableId();
                          const router = useRouter();

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

                        /* eslint-disable sonarjs/no-duplicate-string */
                        import { Injectable, NotFoundException } from '@nestjs/common';
                        import {
                          generatePluginId,
                          generatePluginUserId,
                        Severity: Minor
                        Found in apps/nestjs-backend/src/features/plugin/plugin.service.ts - About 3 hrs to fix

                          File UniverSheet.tsx has 342 lines of code (exceeds 300 allowed). Consider refactoring.
                          Open

                          'use client';
                          
                          import type {
                            IWorkbookData,
                            ICommandInfo,
                          Severity: Minor
                          Found in plugins/src/app/sheet-form-view/components/sheet/UniverSheet.tsx - About 3 hrs to fix

                            File operator.ts has 342 lines of code (exceeds 300 allowed). Consider refactoring.
                            Open

                            /* eslint-disable @typescript-eslint/naming-convention */
                            import { pick, pullAll, uniq } from 'lodash';
                            import { z } from 'zod';
                            import { CellValueType, FieldType } from '../../field/constant';
                            import type { FieldCore } from '../../field/field';
                            Severity: Minor
                            Found in packages/core/src/models/view/filter/operator.ts - About 3 hrs to fix

                              File import.class.ts has 340 lines of code (exceeds 300 allowed). Consider refactoring.
                              Open

                              import { existsSync } from 'fs';
                              import { join } from 'path';
                              import { BadRequestException } from '@nestjs/common';
                              import { getUniqName, FieldType } from '@teable/core';
                              import type { IValidateTypes, IAnalyzeVo } from '@teable/openapi';
                              Severity: Minor
                              Found in apps/nestjs-backend/src/features/import/open-api/import.class.ts - About 2 hrs to fix

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

                                import fs from 'fs';
                                import path from 'path';
                                import type { INestApplication } from '@nestjs/common';
                                import { FieldType, defaultDatetimeFormatting } from '@teable/core';
                                import type { IInplaceImportOptionRo } from '@teable/openapi';
                                Severity: Minor
                                Found in apps/nestjs-backend/test/table-import.e2e-spec.ts - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language