teableio/teable

View on GitHub

Showing 671 of 671 total issues

Function convertCellValue2DBValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  convertCellValue2DBValue(value: unknown): unknown {
    if (this.isMultipleCellValue) {
      return value == null ? value : JSON.stringify(value);
    }
    if (typeof value === 'number' && (isNaN(value) || !isFinite(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 updateOptionsFromUserField has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private async updateOptionsFromUserField(
    tableId: string,
    field: UserFieldDto
  ): Promise<IOpsMap | undefined> {
    const { dbTableName } = await this.prismaService.txClient().tableMeta.findFirstOrThrow({

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

  private async alterSymmetricFieldChange(
    tableId: string,
    oldField: LinkFieldDto,
    newField: LinkFieldDto
  ) {

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

  private async prepareUpdateLinkField(tableId: string, fieldRo: IFieldRo, oldFieldVo: IFieldVo) {
    if (!majorFieldKeysChanged(oldFieldVo, fieldRo)) {
      return mergeWith({}, oldFieldVo, fieldRo, (_oldValue: unknown, newValue: unknown) => {
        if (Array.isArray(newValue)) {
          return newValue;

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

  eval(params: TypedValue<string | number | null | (string | number | null)[]>[]): number | null {
    const findString = params[0].value;
    const targetString = convertValueToString(params[1]);
    let startPosition = params[2]?.value ?? 0;

Severity: Minor
Found in packages/core/src/formula/functions/text.ts - About 25 mins 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 stringToFloat has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function stringToFloat(value: string | unknown): number | null {
  if (!isParsableNumeric(typeof value === 'number' ? value.toString(10) : value ?? '')) {
    return null;
  }
  const v = Number.parseFloat(typeof value === 'string' ? value : (value as number).toString(10));
Severity: Minor
Found in packages/core/src/convert/string-convert.ts - About 25 mins 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 generateReferenceFieldOps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private async generateReferenceFieldOps(fieldId: string) {
    const topoOrdersContext = await this.fieldCalculationService.getTopoOrdersContext([fieldId]);

    const { fieldMap, topoOrdersByFieldId, fieldId2TableId } = topoOrdersContext;
    const topoOrders = topoOrdersByFieldId[fieldId];

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

  async getFilterLinkRecordsByTable(tableId: string, filter?: IFilter) {
    if (!filter) {
      return [];
    }
    const linkFields = await this.prismaService.field.findMany({
Severity: Minor
Found in apps/nestjs-backend/src/features/view/open-api/view-open-api.service.ts - About 25 mins 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 renameViewIndexes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private async renameViewIndexes(dbTableName: string, old2NewViewIdMap: Record<string, string>) {
    const columnInfoQuery = this.dbProvider.columnInfo(dbTableName);
    const columns = await this.prismaService
      .txClient()
      .$queryRawUnsafe<{ name: string }[]>(columnInfoQuery);
Severity: Minor
Found in apps/nestjs-backend/src/features/base/base-duplicate.service.ts - About 25 mins 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 ResetPasswordPage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const ResetPasswordPage = () => {
  const [error, setError] = useState<string>();
  const [password, setPassword] = useState<string>();
  const router = useRouter();
  const code = router.query.code as string;
Severity: Minor
Found in apps/nextjs-app/src/features/auth/pages/ResetPasswordPage.tsx - About 25 mins 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 selectionCoverAttachments has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const selectionCoverAttachments = (selection: CombinedSelection, fields: Field[]) => {
  const { type, ranges } = selection;
  switch (type) {
    case SelectionRegionType.Cells: {
      const [start, end] = ranges;
Severity: Minor
Found in apps/nextjs-app/src/features/app/blocks/view/grid/utils/selection.ts - About 25 mins 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 getGroupRelatedData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  public async getGroupRelatedData(tableId: string, query?: IGetRecordsRo) {
    const { viewId, groupBy: extraGroupBy, filter, search, collapsedGroupIds } = query || {};
    let groupPoints: IGroupPoint[] = [];

    const groupBy = parseGroup(extraGroupBy);
Severity: Minor
Found in apps/nestjs-backend/src/features/record/record.service.ts - About 25 mins 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 handleAggregation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private async handleAggregation(params: {
    dbTableName: string;
    fieldInstanceMap: Record<string, IFieldInstance>;
    fieldInstanceMapWithoutHiddenFields: Record<string, IFieldInstance>;
    filter?: IFilter;
Severity: Minor
Found in apps/nestjs-backend/src/features/aggregation/aggregation.service.ts - About 25 mins 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 getModifiedSystemOpsMap has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  async getModifiedSystemOpsMap(
    tableId: string,
    records: {
      fields: Record<string, unknown>;
      id: string;
Severity: Minor
Found in apps/nestjs-backend/src/features/calculation/system-field.service.ts - About 25 mins 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 checkConfig has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private checkConfig() {
    const { tokenExpireIn } = this.config;
    if (ms(tokenExpireIn) >= ms('7d')) {
      throw new BadRequestException('Token expire in must be more than 7 days');
    }
Severity: Minor
Found in apps/nestjs-backend/src/features/attachments/plugins/s3.ts - About 25 mins 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 shouldSkipCompute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private shouldSkipCompute(field: IFieldInstance, recordItem: IRecordItem) {
    if (!field.isComputed && field.type !== FieldType.Link) {
      return true;
    }

Severity: Minor
Found in apps/nestjs-backend/src/features/calculation/reference.service.ts - About 25 mins 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 getFieldsByProjection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private async getFieldsByProjection(
    tableId: string,
    projection?: { [fieldNameOrId: string]: boolean },
    fieldKeyType: FieldKeyType = FieldKeyType.Id
  ) {
Severity: Minor
Found in apps/nestjs-backend/src/features/record/record.service.ts - About 25 mins 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 presigned has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  async presigned(
    bucket: string,
    dir: string,
    presignedParams: IPresignParams
  ): Promise<IPresignRes> {
Severity: Minor
Found in apps/nestjs-backend/src/features/attachments/plugins/minio.ts - About 25 mins 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 joinOriginLookup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private joinOriginLookup(lookupField: IFieldInstance, lookupValues: unknown[] | unknown) {
    if (Array.isArray(lookupValues)) {
      const flatten = lookupValues.map((value) => {
        if (Array.isArray(value)) {
          return lookupField.cellValue2String(value);
Severity: Minor
Found in apps/nestjs-backend/src/features/calculation/reference.service.ts - About 25 mins 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 InplaceFieldConfigPanel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const InplaceFieldConfigPanel = (props: IInplaceFieldConfigPanel) => {
  const baseId = useBaseId() as string;
  const { t } = useTranslation(['table']);
  const { tableId, workSheets, insertConfig, onChange, errorMessage } = 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

Severity
Category
Status
Source
Language