[Tech debt] SonarQube S4487: remove unread private fields (12 backend) #245

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

Surfaced by SonarQube (api.spikersoft.com), rule csharpsquid:S4487, severity CRITICAL (MAINTAINABILITY). Private fields that are assigned but never read — dead state, often a leftover injected dependency. Easy wins (delete field + constructor param, or actually use it).

Locations

  • SpikerSoft.Api/Domain/CodeExecution/CodeSubmissionsController.cs:23 (_logger)
  • SpikerSoft.Business/Services/QuizAnalyticsService.cs:264 (TotalChanges)
  • SpikerSoft.EventHandlers.MetadataExtractor/Services/MetadataExtractionService.cs:30 (_configuration)
  • SpikerSoft.EventHandlers.UploadCoordinator/Services/UploadOrchestrator.cs:27 (_configuration)
  • SpikerSoft.Api/Domain/Assessment/AssessmentController.cs:20 (_assessmentReportService)
  • SpikerSoft.Api/Domain/Assessment/AssessmentController.cs:21 (_quizAttemptService)
  • SpikerSoft.Api/Domain/AddressTypes/AddressTypesController.cs:35 (_logger)
  • SpikerSoft.Api/Middleware/RedisRateLimitMiddleware.cs:15 (_options)
  • SpikerSoft.Business/Domain/Tools/Networking/Ping/PingCommandHandler.cs:13 (_configuration)
  • SpikerSoft.Business/Domain/Twilio/Commands/ProcessTwilioWebhook/ProcessTwilioWebhookCommandHandler.cs:23 (_configuration)
  • SpikerSoft.Business/Domain/Twilio/Commands/ProcessVerifyWebhook/ProcessVerifyWebhookCommandHandler.cs:22 (_configuration)
  • SpikerSoft.Business/ToolsManager.cs:13 (_mongoClient)

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

Surfaced by SonarQube (`api.spikersoft.com`), rule `csharpsquid:S4487`, severity CRITICAL (MAINTAINABILITY). Private fields that are assigned but never read — dead state, often a leftover injected dependency. Easy wins (delete field + constructor param, or actually use it). ## Locations - `SpikerSoft.Api/Domain/CodeExecution/CodeSubmissionsController.cs:23` (`_logger`) - `SpikerSoft.Business/Services/QuizAnalyticsService.cs:264` (`TotalChanges`) - `SpikerSoft.EventHandlers.MetadataExtractor/Services/MetadataExtractionService.cs:30` (`_configuration`) - `SpikerSoft.EventHandlers.UploadCoordinator/Services/UploadOrchestrator.cs:27` (`_configuration`) - `SpikerSoft.Api/Domain/Assessment/AssessmentController.cs:20` (`_assessmentReportService`) - `SpikerSoft.Api/Domain/Assessment/AssessmentController.cs:21` (`_quizAttemptService`) - `SpikerSoft.Api/Domain/AddressTypes/AddressTypesController.cs:35` (`_logger`) - `SpikerSoft.Api/Middleware/RedisRateLimitMiddleware.cs:15` (`_options`) - `SpikerSoft.Business/Domain/Tools/Networking/Ping/PingCommandHandler.cs:13` (`_configuration`) - `SpikerSoft.Business/Domain/Twilio/Commands/ProcessTwilioWebhook/ProcessTwilioWebhookCommandHandler.cs:23` (`_configuration`) - `SpikerSoft.Business/Domain/Twilio/Commands/ProcessVerifyWebhook/ProcessVerifyWebhookCommandHandler.cs:22` (`_configuration`) - `SpikerSoft.Business/ToolsManager.cs:13` (`_mongoClient`) _Rule: https://rules.sonarsource.com/csharp/RSPEC-4487/_
spikerj added the sonarqube label 2026-06-19 18:44:52 +00:00
Author
Owner

Resolved in spikersoft-backend PR #12 (merged to master). Removed 11 unread injected fields plus their now-dead ctor params/args across controllers, middleware, handlers and services, and updated all call sites and tests. Closing.

Resolved in spikersoft-backend PR #12 (merged to `master`). Removed 11 unread injected fields plus their now-dead ctor params/args across controllers, middleware, handlers and services, and updated all call sites and tests. Closing.
Sign in to join this conversation.