SonarQube CRITICAL CODE_SMELL: Define a constant instead of duplicating this literal "This profile comment is m #912

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

SonarQube issue detected.

SonarQube key: 80c3db7e-8350-4326-9817-9799a52729ce
Severity: CRITICAL
Type: CODE_SMELL
Location: myvideogamelist:tests/Feature/ContentFlagTest.php:196
Message: Define a constant instead of duplicating this literal "This profile comment is moderated." 3 times.

https://sonarqube.linuxbox.ninja/project/issues?id=myvideogamelist&issues=80c3db7e-8350-4326-9817-9799a52729ce&open=80c3db7e-8350-4326-9817-9799a52729ce

SonarQube issue detected. **SonarQube key:** `80c3db7e-8350-4326-9817-9799a52729ce` **Severity:** `CRITICAL` **Type:** `CODE_SMELL` **Location:** `myvideogamelist:tests/Feature/ContentFlagTest.php:196` **Message:** Define a constant instead of duplicating this literal "This profile comment is moderated." 3 times. https://sonarqube.linuxbox.ninja/project/issues?id=myvideogamelist&issues=80c3db7e-8350-4326-9817-9799a52729ce&open=80c3db7e-8350-4326-9817-9799a52729ce <!-- sonarqube:issue:80c3db7e-8350-4326-9817-9799a52729ce -->
Codex self-assigned this 2026-08-04 18:50:38 -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#912
No description provided.