SonarQube MAJOR CODE_SMELL: Define and throw a dedicated exception instead of using a generic one. #893

Closed
opened 2026-08-04 16:56:30 -05:00 by forgejo-actions · 1 comment

SonarQube issue detected.

SonarQube key: 1395e3c9-b3ec-49fa-81ce-e8a4a91b6c4a
Severity: MAJOR
Type: CODE_SMELL
Location: myvideogamelist:app/Console/Commands/SyncProductionData.php:178
Message: Define and throw a dedicated exception instead of using a generic one.

https://sonarqube.linuxbox.ninja/project/issues?id=myvideogamelist&issues=1395e3c9-b3ec-49fa-81ce-e8a4a91b6c4a&open=1395e3c9-b3ec-49fa-81ce-e8a4a91b6c4a

SonarQube issue detected. **SonarQube key:** `1395e3c9-b3ec-49fa-81ce-e8a4a91b6c4a` **Severity:** `MAJOR` **Type:** `CODE_SMELL` **Location:** `myvideogamelist:app/Console/Commands/SyncProductionData.php:178` **Message:** Define and throw a dedicated exception instead of using a generic one. https://sonarqube.linuxbox.ninja/project/issues?id=myvideogamelist&issues=1395e3c9-b3ec-49fa-81ce-e8a4a91b6c4a&open=1395e3c9-b3ec-49fa-81ce-e8a4a91b6c4a <!-- sonarqube:issue:1395e3c9-b3ec-49fa-81ce-e8a4a91b6c4a -->
Codex self-assigned this 2026-08-04 18:50:22 -05:00
Member

Resolved by PR #914.

Notes for future readers:

  • Content flag test-only Sonar findings were handled by extracting repeated profile/content literals into named constants and replacing the nested ternary helper with explicit owner resolution.
  • The unused ContentFlagTargetResolver::isHidden() $type parameter was removed because the method resolves hidden state from the model class and id.
  • Production sync command findings were handled by introducing ProductionSyncCommandException, using it for command/preflight/process failures, and splitting the production data/snapshot command flow into smaller helpers to reduce return count and cognitive complexity.
  • The legacy mvgl:sync-production-snapshot command remains retired per docs/DEV_PRODUCTION_PARITY.md; the cleanup preserves its existing dry-run/write/rollback behavior while satisfying the analyzer.

Verification from the PR:

  • php artisan test --compact tests/Feature/ContentFlagTest.php tests/Feature/ProductionDataSyncCommandTest.php tests/Feature/ProductionSnapshotCommandTest.php
  • vendor/bin/pint --dirty --format agent
  • composer stan
Resolved by PR #914. Notes for future readers: - Content flag test-only Sonar findings were handled by extracting repeated profile/content literals into named constants and replacing the nested ternary helper with explicit owner resolution. - The unused `ContentFlagTargetResolver::isHidden()` `$type` parameter was removed because the method resolves hidden state from the model class and id. - Production sync command findings were handled by introducing `ProductionSyncCommandException`, using it for command/preflight/process failures, and splitting the production data/snapshot command flow into smaller helpers to reduce return count and cognitive complexity. - The legacy `mvgl:sync-production-snapshot` command remains retired per `docs/DEV_PRODUCTION_PARITY.md`; the cleanup preserves its existing dry-run/write/rollback behavior while satisfying the analyzer. Verification from the PR: - `php artisan test --compact tests/Feature/ContentFlagTest.php tests/Feature/ProductionDataSyncCommandTest.php tests/Feature/ProductionSnapshotCommandTest.php` - `vendor/bin/pint --dirty --format agent` - `composer stan`
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MyVideoGameList/myvideogamelist.com#893
No description provided.