SonarQube CRITICAL CODE_SMELL: Define a constant instead of duplicating this literal "The Search Target Partial #702

Closed
opened 2026-06-10 19:33:09 -05:00 by forgejo-actions · 1 comment

SonarQube issue detected.

SonarQube key: 7d290bec-47bb-4f97-b84e-88615e516762
Severity: CRITICAL
Type: CODE_SMELL
Location: myvideogamelist:tests/Feature/GameSearchTest.php:209
Message: Define a constant instead of duplicating this literal "The Search Target Partial" 3 times.

https://sonarqube.linuxbox.ninja/project/issues?id=myvideogamelist&issues=7d290bec-47bb-4f97-b84e-88615e516762&open=7d290bec-47bb-4f97-b84e-88615e516762

SonarQube issue detected. **SonarQube key:** `7d290bec-47bb-4f97-b84e-88615e516762` **Severity:** `CRITICAL` **Type:** `CODE_SMELL` **Location:** `myvideogamelist:tests/Feature/GameSearchTest.php:209` **Message:** Define a constant instead of duplicating this literal "The Search Target Partial" 3 times. https://sonarqube.linuxbox.ninja/project/issues?id=myvideogamelist&issues=7d290bec-47bb-4f97-b84e-88615e516762&open=7d290bec-47bb-4f97-b84e-88615e516762 <!-- sonarqube:issue:7d290bec-47bb-4f97-b84e-88615e516762 -->
Codex self-assigned this 2026-06-10 19:51:55 -05:00
Member

Resolved by extracting duplicated GameSearchTest literals into descriptive Pest file-level constants for the empty search prompt, exact search target title, and prefixed partial title.

Verification:

  • php artisan test --compact tests/Feature/GameSearchTest.php --filter="search page renders for guests and authenticated users|blank and whitespace searches render a clear validation message|search orders exact name matches before prefix partial and alternate title matches" (3 passed, 14 assertions)
  • vendor/bin/pint --dirty --format agent

Note: an initial full-file GameSearchTest run produced no output after several minutes and was interrupted; the touched tests were rerun with a focused filter and passed.

Committed and pushed as ae5a2c1.

Resolved by extracting duplicated GameSearchTest literals into descriptive Pest file-level constants for the empty search prompt, exact search target title, and prefixed partial title. Verification: - php artisan test --compact tests/Feature/GameSearchTest.php --filter="search page renders for guests and authenticated users|blank and whitespace searches render a clear validation message|search orders exact name matches before prefix partial and alternate title matches" (3 passed, 14 assertions) - vendor/bin/pint --dirty --format agent Note: an initial full-file GameSearchTest run produced no output after several minutes and was interrupted; the touched tests were rerun with a focused filter and passed. Committed and pushed as ae5a2c1.
Codex 2026-06-10 20:04:27 -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#702
No description provided.