File reference.service.ts
has 1042 lines of code (exceeds 300 allowed). Consider refactoring. Open
import {
BadRequestException,
Injectable,
InternalServerErrorException,
Logger,
ReferenceService
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
@Injectable()
export class ReferenceService {
private readonly logger = new Logger(ReferenceService.name);
constructor(
Function calculateComputeField
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private calculateComputeField(
field: IFieldInstance,
fieldMap: IFieldMap,
recordItem: IRecordItem,
userMap?: { [userId: string]: IUserInfoVo }
- 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 calculateLookup
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private calculateLookup(
field: IFieldInstance,
lookedField: IFieldInstance,
recordItem: IRecordItem
) {
- 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 getLinkOrderFromTopoOrders
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
getLinkOrderFromTopoOrders(params: {
topoOrders: ITopoItem[];
fieldMap: IFieldMap;
}): ITopoLinkOrder[] {
const newOrder: ITopoLinkOrder[] = [];
- 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 calculateLink
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private calculateLink(
field: LinkFieldDto,
virtualField: IFieldInstance,
record: IRecord,
lookupValues: unknown
- 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 calculateRollupAndLink
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private calculateRollupAndLink(
field: IFieldInstance,
relationship: Relationship,
lookupField: IFieldInstance,
record: IRecord,
- 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 affectedRecordItemsQuerySql
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
affectedRecordItemsQuerySql(
startFieldIds: string[],
fieldMap: IFieldMap,
linkAdjacencyMap: IAdjacencyMap,
startRecordIds: 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
Avoid too many return
statements within this function. Open
return dependencies[0].fields[fieldId] ?? null;
Avoid too many return
statements within this function. Open
return null;
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;
}
- 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 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);
- 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 getComputedUsers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private getComputedUsers(
field: IFieldInstance,
record: IRecord,
userMap: { [userId: string]: IUserInfoVo }
) {
- 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"