[Tech debt] SonarQube S2696: static field written from instance method (3 backend) #247

Closed
opened 2026-06-19 18:44:59 +00:00 by spikerj · 1 comment
Owner

Surfaced by SonarQube (api.spikersoft.com), rule csharpsquid:S2696, severity CRITICAL (MAINTAINABILITY). Updating static state from an instance method is a thread-safety / shared-state hazard.

Locations

  • SpikerSoft.Business/Services/PostalCodeSeederService.cs:35
  • SpikerSoft.Business/Services/PostalCodeSeederService.cs:36
  • SpikerSoft.Business.Ai.Workers/Services/BookAnalysisService.cs:511

Fix

Make the field instance-scoped, or make the method static, or guard the shared write appropriately.

Rule: https://rules.sonarsource.com/csharp/RSPEC-2696/

Surfaced by SonarQube (`api.spikersoft.com`), rule `csharpsquid:S2696`, severity CRITICAL (MAINTAINABILITY). Updating `static` state from an instance method is a thread-safety / shared-state hazard. ## Locations - `SpikerSoft.Business/Services/PostalCodeSeederService.cs:35` - `SpikerSoft.Business/Services/PostalCodeSeederService.cs:36` - `SpikerSoft.Business.Ai.Workers/Services/BookAnalysisService.cs:511` ## Fix Make the field instance-scoped, or make the method `static`, or guard the shared write appropriately. _Rule: https://rules.sonarsource.com/csharp/RSPEC-2696/_
spikerj added the sonarqube label 2026-06-19 18:44:59 +00:00
Author
Owner

Resolved in spikersoft-backend PR #12 (merged to master). Static-state writes in PostalCodeSeederService and BookAnalysisService now go through static helper methods, so instance methods no longer mutate static fields directly. Closing.

Resolved in spikersoft-backend PR #12 (merged to `master`). Static-state writes in `PostalCodeSeederService` and `BookAnalysisService` now go through static helper methods, so instance methods no longer mutate static fields directly. Closing.
Sign in to join this conversation.