File record.service.ts
has 1459 lines of code (exceeds 300 allowed). Consider refactoring. Open
/* eslint-disable @typescript-eslint/naming-convention */
import {
BadRequestException,
Injectable,
InternalServerErrorException,
RecordService
has 50 functions (exceeds 20 allowed). Consider refactoring. Open
@Injectable()
export class RecordService {
private logger = new Logger(RecordService.name);
constructor(
Function getViewProjection
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private async getViewProjection(
tableId: string,
query: IGetRecordsRo
): Promise<Record<string, boolean> | undefined> {
const viewId = query.viewId;
- Read upRead up
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[],
- Read upRead up
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 buildLinkCandidateQuery
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
async buildLinkCandidateQuery(
queryBuilder: Knex.QueryBuilder,
tableId: string,
dbTableName: string,
filterLinkCellCandidate: [string, string] | string
- Read upRead up
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 getPreviewUrlTokenMap
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private async getPreviewUrlTokenMap(
records: ISnapshotBase<IRecord>[],
fields: IFieldInstance[],
fieldKeyType: FieldKeyType
) {
- Read upRead up
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 recordsPresignedUrl
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
@Timing()
private async recordsPresignedUrl(
records: ISnapshotBase<IRecord>[],
fields: IFieldInstance[],
fieldKeyType: FieldKeyType
- Read upRead up
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 buildFilterSortQuery
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async buildFilterSortQuery(
tableId: string,
query: Pick<
IGetRecordsRo,
| 'viewId'
- Read upRead up
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 updateRecordIndexes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async updateRecordIndexes(
tableId: string,
recordsWithOrder: {
id: string;
order?: Record<string, number>;
- Read upRead up
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 buildLinkSelectedQuery
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async buildLinkSelectedQuery(
queryBuilder: Knex.QueryBuilder,
tableId: string,
dbTableName: string,
filterLinkCellSelected: [string, string] | string
- Read upRead up
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> {
- Read upRead up
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
- Read upRead up
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,
- Read upRead up
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);
- Read upRead up
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
) {
- Read upRead up
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"