From 3abcedadad04913b7cf65e51d88323d411466e71 Mon Sep 17 00:00:00 2001 From: thalesraymond <32554150+thalesraymond@users.noreply.github.com> Date: Thu, 19 Mar 2026 10:16:06 +0000 Subject: [PATCH] refactor(TaskStateManager): add readonly modifier to unmodified private fields Added the `readonly` modifier to the following private class fields in `TaskStateManager`: - `results` - `running` - `dependencyGraph` - `dependencyCounts` - `taskDefinitions` - `eventBus` This addresses SonarCloud issue AZyNlgI08FJsAYbX6MbX and related issues (typescript:S2933) which require fields never reassigned after initialization in the constructor to be marked as `readonly`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- src/TaskStateManager.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/TaskStateManager.ts b/src/TaskStateManager.ts index 7a7399d..8e660e8 100644 --- a/src/TaskStateManager.ts +++ b/src/TaskStateManager.ts @@ -7,17 +7,17 @@ import { EventBus } from "./EventBus.js"; * Handles dependency resolution and event emission for state changes. */ export class TaskStateManager { - private results = new Map(); + private readonly results = new Map(); private pendingSteps = new Set>(); - private running = new Set(); + private readonly running = new Set(); // Optimization structures - private dependencyGraph = new Map[]>(); - private dependencyCounts = new Map(); + private readonly dependencyGraph = new Map[]>(); + private readonly dependencyCounts = new Map(); private readyQueue: TaskStep[] = []; - private taskDefinitions = new Map>(); + private readonly taskDefinitions = new Map>(); - constructor(private eventBus: EventBus) {} + constructor(private readonly eventBus: EventBus) {} /** * Initializes the state with the given steps.