refactor/doctor: hoist duplicated doc-path and message literals into constants #76

Merged
pti merged 1 commit from refactor/doctor-literal-constants into main 2026-10-19 15:56:58 +02:00
Owner

Closes #67, part of the SonarQube cleanup in #73. Sonar go:S1192 flagged ten repeated literals across internal/doctor, mostly DocRef paths plus four repeated finding messages. New file docref.go holds the four shared doc paths as unexported constants and every plain DocRef use in the package switches to them, anchored refs and single-use paths stay literal. The four repeated messages become constants at the end of their own files. Names carry their file-group prefix because the invariants test requires it. Also folds the go:S1871 duplicate branch in render_human.go renderHeader: ConfigLoaded and default printed the same header, so ConfigLoaded is now an empty case and the shared print follows the switch, output identical for every state and the switch stays exhaustive. Zero output change, no test or golden file touched, all gates pass. 🤖 Generated with Claude Code

Closes #67, part of the SonarQube cleanup in #73. Sonar go:S1192 flagged ten repeated literals across internal/doctor, mostly DocRef paths plus four repeated finding messages. New file docref.go holds the four shared doc paths as unexported constants and every plain DocRef use in the package switches to them, anchored refs and single-use paths stay literal. The four repeated messages become constants at the end of their own files. Names carry their file-group prefix because the invariants test requires it. Also folds the go:S1871 duplicate branch in render_human.go renderHeader: ConfigLoaded and default printed the same header, so ConfigLoaded is now an empty case and the shared print follows the switch, output identical for every state and the switch stays exhaustive. Zero output change, no test or golden file touched, all gates pass. 🤖 Generated with Claude Code
refactor(doctor): hoist duplicated doc-path and message literals into constants
All checks were successful
Lint / lint (pull_request) Successful in 1m12s
Lint / sonarqube (pull_request) Has been skipped
b6b754e094
Closes #67.

DocRef paths now live in one constant block (docref.go); repeated finding
texts become named constants next to their checks. Identifiers carry the
file-group prefix required by the package's invariants test. No output
change.

renderHeader: ConfigLoaded and default had identical bodies (S1871); the
shared body now follows the switch, and all ConfigState members stay named.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
pti merged commit 6e07b4870b into main 2026-10-19 15:56:58 +02:00
pti deleted branch refactor/doctor-literal-constants 2026-10-19 15:56:59 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
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
pti/wraptool!76
No description provided.