apps/nestjs-backend/src/event-emitter/event-emitter.service.ts
File event-emitter.service.ts
has 338 lines of code (exceeds 300 allowed). Consider refactoring. Open
Open
import { Injectable, Logger } from '@nestjs/common';
import { EventEmitter2 } from '@nestjs/event-emitter';
import type { ICreateOpBuilder, IOpBuilder, IOpContextBase, IOtOperation } from '@teable/core';
import {
FieldOpBuilder,
EventEmitterService
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@Injectable()
export class EventEmitterService {
private readonly logger = new Logger(EventEmitterService.name);
private readonly eventNameMapping = {
Function generateEventsFromRawOps
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
private generateEventsFromRawOps(rawOpMap: IRawOpMap, eventManager: Map<string, OpEvent>) {
for (const collection in rawOpMap) {
const [docType, docId] = collection.split('_') as [DocType, string];
const data = rawOpMap[collection];
- 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 buildAndApplyOp
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
private buildAndApplyOp(
otOperation: IOtOperation,
acc: object,
propertyCategory: string,
nodeId: 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"