Showing 8 of 8 total issues
Function validateDependencyTree
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function validateDependencyTree(services: { [id: string]: NormalizedServiceConfig }): void { const serviceIds = Object.keys(services); for (const [serviceId, { dependencies }] of Object.entries(services)) { for (const dependency of dependencies) { if (!serviceIds.includes(dependency)) {
- Read upRead up
Function validateDependencyTree
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function validateDependencyTree(services: { [id: string]: NormalizedServiceConfig }): void { const serviceIds = Object.keys(services); for (const [serviceId, { dependencies }] of Object.entries(services)) { for (const dependency of dependencies) { if (!serviceIds.includes(dependency)) {
Function constructor
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(config: NormalizedCompositeServiceConfig) { this.config = config; if (this.config.windowsCtrlCShutdown) { require("generate-ctrl-c-event"); // make sure this module loads before we even start
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (this.config.crashesLength > 0) { this.crashes.push(crash); if (this.crashes.length > this.config.crashesLength) { this.crashes.shift(); }
- Read upRead up
Similar blocks of code found in 2 locations. Consider refactoring. Open
tapStreamLines((line) => { this.logTail.push(line); if (this.logTail.length > this.serviceConfig.logTailLength) { this.logTail.shift(); }
- Read upRead up
Function handleCrash
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async handleCrash(proc: ServiceProcess) { this.logger.log("info", `Service '${this.id}' crashed`); const delayPromise = delay(this.config.minimumRestartDelay); const crash: ServiceCrash = { date: new Date(),
Function constructor
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor( serviceId: string, serviceConfig: NormalizedServiceConfig, logger: Logger, onCrash: () => void
Function end
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public end(windowsCtrlCShutdown: boolean) { if (!this.wasEndCalled) { this.wasEndCalled = true; if (this.isRunning()) { if (windowsCtrlCShutdown) {
- Read upRead up