teableio/teable

View on GitHub

Showing 671 of 671 total issues

Function mergeWithDefaultSort has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function mergeWithDefaultSort(
  defaultViewSort?: string | null,
  querySort?: ISortItem[]
): ISortItem[] {
  if (!defaultViewSort && !querySort) {
Severity: Minor
Found in packages/core/src/models/view/sort/sort.ts - About 35 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 batchUpdateFields has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  async batchUpdateFields(tableId: string, opData: { fieldId: string; ops: IOtOperation[] }[]) {
    if (!opData.length) return;

    const fieldRaw = await this.prismaService.txClient().field.findMany({
      where: { tableId, id: { in: opData.map((data) => data.fieldId) }, deletedTime: null },
Severity: Minor
Found in apps/nestjs-backend/src/features/field/field.service.ts - About 35 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 rowSelectionToIds has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private async rowSelectionToIds(tableId: string, query: IRangesToIdQuery): Promise<string[]> {
    const { type, ranges } = query;
    if (type === RangeType.Columns) {
      const result = await this.recordService.getDocIdsByQuery(tableId, {
        ...query,
Severity: Minor
Found in apps/nestjs-backend/src/features/selection/selection.service.ts - About 35 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 eval has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  eval(params: TypedValue<string | number | null>[], context: IFormulaContext): number | null {
    const startDate = getDayjs(params[0].value as string, context.timeZone);
    const endDate = getDayjs(params[1].value as string, context.timeZone);

    if (startDate == null || endDate == null) return null;
Severity: Minor
Found in packages/core/src/formula/functions/date-time.ts - About 35 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 generateFilterItem has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const generateFilterItem = (field: IFieldInstance, value: unknown) => {
  let operator: IOperator = isNot.value;
  const { id: fieldId, type, isMultipleCellValue, options } = field;

  if (shouldFilterByDefaultValue(field)) {
Severity: Minor
Found in apps/nestjs-backend/src/utils/filter.ts - About 35 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 getValidStatisticFunc has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const getValidStatisticFunc = (field?: {
  type: FieldType;
  cellValueType: CellValueType;
  isMultipleCellValue?: boolean;
}): StatisticsFunc[] => {
Severity: Minor
Found in packages/core/src/models/aggregation/statistic.ts - About 35 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 updatePlugin has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  async updatePlugin(id: string, updatePluginRo: IUpdatePluginRo): Promise<IUpdatePluginVo> {
    const userId = this.cls.get('user.id');
    const isAdmin = this.cls.get('user.isAdmin');
    const { name, description, detailDesc, helpUrl, logo, i18n, positions, url } = updatePluginRo;
    const res = await this.prismaService.$tx(async (prisma) => {
Severity: Minor
Found in apps/nestjs-backend/src/features/plugin/plugin.service.ts - About 35 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 isLinkCellValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function isLinkCellValue(value: unknown): boolean {
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  function isLinkCellItem(item: any): boolean {
    if (typeof item !== 'object' || item == null) {
      return false;
Severity: Minor
Found in apps/nestjs-backend/src/features/calculation/utils/detect-link.ts - About 35 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 getRecordIndexes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  async getRecordIndexes(
    tableId: string,
    recordIds: string[],
    viewId?: string
  ): Promise<Record<string, number>[] | undefined> {
Severity: Minor
Found in apps/nestjs-backend/src/features/record/record.service.ts - About 35 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 undo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  async undo(operation: IUpdateRecordsOperation) {
    const { params, result } = operation;
    const { tableId, recordIds, fieldIds } = params;
    const { cellContexts, ordersMap } = result;

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

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

  private async createBatch(
    tableId: string,
    records: IRecordInnerRo[],
    fieldKeyType: FieldKeyType,
    fieldRaws: IFieldRaws
Severity: Minor
Found in apps/nestjs-backend/src/features/record/record.service.ts - About 35 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 calculateRollupAndLink has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private calculateRollupAndLink(
    field: IFieldInstance,
    relationship: Relationship,
    lookupField: IFieldInstance,
    record: IRecord,
Severity: Minor
Found in apps/nestjs-backend/src/features/calculation/reference.service.ts - About 35 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 redo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  async redo(operation: IUpdateRecordsOperation) {
    const { params, result } = operation;
    const { tableId, recordIds, fieldIds } = params;
    const { cellContexts, ordersMap } = result;

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

  private reBuildFieldRaw(
    toBaseId: string,
    field: IFieldInstance,
    fieldRaw: Field,
    old2NewTableIdMap: Record<string, string>,
Severity: Minor
Found in apps/nestjs-backend/src/features/base/base-duplicate.service.ts - About 35 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 convertViewVoAttachmentUrl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  convertViewVoAttachmentUrl(viewVo: IViewVo) {
    if (viewVo.type === ViewType.Form) {
      const formOptions = viewVo.options as IFormViewOptions;
      formOptions?.coverUrl &&
        (formOptions.coverUrl = formOptions.coverUrl
Severity: Minor
Found in apps/nestjs-backend/src/features/view/view.service.ts - About 35 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 getFilterByCollapsedGroup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private getFilterByCollapsedGroup({
    groupBy,
    groupPoints,
    fieldInstanceMap,
    collapsedGroupIds,
Severity: Minor
Found in apps/nestjs-backend/src/features/record/record.service.ts - About 35 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 affectedRecordItemsQuerySql has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  affectedRecordItemsQuerySql(
    startFieldIds: string[],
    fieldMap: IFieldMap,
    linkAdjacencyMap: IAdjacencyMap,
    startRecordIds: string[]
Severity: Minor
Found in apps/nestjs-backend/src/features/calculation/reference.service.ts - About 35 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 KanbanToolbar has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const KanbanToolbar: React.FC<{ disabled?: boolean }> = (props) => {
  const { disabled } = props;
  const view = useView() as KanbanView | undefined;
  const allFields = useFields({ withHidden: true, withDenied: true });
  const { onFilterChange, onSortChange } = useToolbarChange();

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

  private async fetchRecordMap(
    tableId2DbTableName: { [tableId: string]: string },
    fieldMapByTableId: { [tableId: string]: IFieldMap },
    recordMapByTableId: IRecordMapByTableId,
    cellContexts: ICellContext[],
Severity: Minor
Found in apps/nestjs-backend/src/features/calculation/link.service.ts - About 35 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

Severity
Category
Status
Source
Language