SonarQube MAJOR CODE_SMELL: Extract this nested ternary operation into an independent statement. #747

Closed
opened 2026-06-12 09:32:43 -05:00 by forgejo-actions · 1 comment

SonarQube issue detected.

SonarQube key: 00230903-5e4e-4cf4-b5b9-ec9444f611b0
Severity: MAJOR
Type: CODE_SMELL
Location: myvideogamelist:app/Http/Controllers/UserFriendController.php:86
Message: Extract this nested ternary operation into an independent statement.

https://sonarqube.linuxbox.ninja/project/issues?id=myvideogamelist&issues=00230903-5e4e-4cf4-b5b9-ec9444f611b0&open=00230903-5e4e-4cf4-b5b9-ec9444f611b0

SonarQube issue detected. **SonarQube key:** `00230903-5e4e-4cf4-b5b9-ec9444f611b0` **Severity:** `MAJOR` **Type:** `CODE_SMELL` **Location:** `myvideogamelist:app/Http/Controllers/UserFriendController.php:86` **Message:** Extract this nested ternary operation into an independent statement. https://sonarqube.linuxbox.ninja/project/issues?id=myvideogamelist&issues=00230903-5e4e-4cf4-b5b9-ec9444f611b0&open=00230903-5e4e-4cf4-b5b9-ec9444f611b0 <!-- sonarqube:issue:00230903-5e4e-4cf4-b5b9-ec9444f611b0 -->
Codex self-assigned this 2026-06-12 09:52:03 -05:00
Member

Fixed

  • Reduced syncTableFromProduction(), SyncProdProfileComments::handle(), and SyncProdUserSiteSettings::handle() to a single final exit-code return.
  • Replaced the 9-parameter shared sync writer with an options array.
  • Extracted the friend-add JSON status code before the response ternary to remove the nested ternary.

Commit: c81ca49

Verification

vendor/bin/pint --format agent app/Console/Commands/Concerns/SyncsProdTables.php app/Console/Commands/SyncProdProfileComments.php app/Console/Commands/SyncProdUserSiteSettings.php app/Http/Controllers/UserFriendController.php
git diff --check
php artisan test --compact tests/Feature/SyncProdProfileCommentsCommandTest.php tests/Feature/SyncProdUserSiteSettingsCommandTest.php tests/Feature/SyncProdRolesCommandTest.php tests/Feature/SyncDevOgFavoritesCommandTest.php tests/Feature/UserFriendTest.php

Result: 26 passed, 195 assertions.

## Fixed - Reduced `syncTableFromProduction()`, `SyncProdProfileComments::handle()`, and `SyncProdUserSiteSettings::handle()` to a single final exit-code return. - Replaced the 9-parameter shared sync writer with an options array. - Extracted the friend-add JSON status code before the response ternary to remove the nested ternary. Commit: `c81ca49` ## Verification ```bash vendor/bin/pint --format agent app/Console/Commands/Concerns/SyncsProdTables.php app/Console/Commands/SyncProdProfileComments.php app/Console/Commands/SyncProdUserSiteSettings.php app/Http/Controllers/UserFriendController.php git diff --check php artisan test --compact tests/Feature/SyncProdProfileCommentsCommandTest.php tests/Feature/SyncProdUserSiteSettingsCommandTest.php tests/Feature/SyncProdRolesCommandTest.php tests/Feature/SyncDevOgFavoritesCommandTest.php tests/Feature/UserFriendTest.php ``` Result: `26 passed, 195 assertions`.
Codex 2026-06-12 09:58:40 -05:00
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#747
No description provided.