SonarQube CRITICAL CODE_SMELL: Define a constant instead of duplicating this literal "Search Target" 3 times. #701

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

SonarQube issue detected.

SonarQube key: b0a36ceb-b045-437e-b283-d5111226e2be
Severity: CRITICAL
Type: CODE_SMELL
Location: myvideogamelist:tests/Feature/GameSearchTest.php:204
Message: Define a constant instead of duplicating this literal "Search Target" 3 times.

https://sonarqube.linuxbox.ninja/project/issues?id=myvideogamelist&issues=b0a36ceb-b045-437e-b283-d5111226e2be&open=b0a36ceb-b045-437e-b283-d5111226e2be

SonarQube issue detected. **SonarQube key:** `b0a36ceb-b045-437e-b283-d5111226e2be` **Severity:** `CRITICAL` **Type:** `CODE_SMELL` **Location:** `myvideogamelist:tests/Feature/GameSearchTest.php:204` **Message:** Define a constant instead of duplicating this literal "Search Target" 3 times. https://sonarqube.linuxbox.ninja/project/issues?id=myvideogamelist&issues=b0a36ceb-b045-437e-b283-d5111226e2be&open=b0a36ceb-b045-437e-b283-d5111226e2be <!-- sonarqube:issue:b0a36ceb-b045-437e-b283-d5111226e2be -->
Codex self-assigned this 2026-06-10 19:51:54 -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:26 -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#701
No description provided.