Skip to content

chore: reduce code-health baseline debt - #31

Merged
sarthakagrawal927 merged 1 commit into
mainfrom
fix/reduce-code-health-debt-26
Aug 15, 2026
Merged

chore: reduce code-health baseline debt#31
sarthakagrawal927 merged 1 commit into
mainfrom
fix/reduce-code-health-debt-26

Conversation

@sarthakagrawal927

@sarthakagrawal927 sarthakagrawal927 commented Aug 14, 2026

Copy link
Copy Markdown
Member

Closes #26

Summary

Reduces code-health debt across the TypeScript codebase by fixing format violations, lowering complexity, and eliminating cross-game duplication. All ratcheted baselines lowered to match the improved measurements.

Changes

Format debt: 19 → 0 files

Ran biome format on all tracked TypeScript paths to fix every outstanding formatting violation.

Complexity violations: 6 → 3

  • server/src/server.ts: Extracted routePose helper from the route switch to reduce CCN from 17 to 13.
  • web/src/sdk/skeleton.ts: Extracted drawArm helper from drawSkeleton to reduce CCN from 16 to 10.
  • web/src/sdk/room.ts: Moved hostFrom after the Room class to fix a lizard misparse that attributed the entire class body to the function (CCN 17→4, length 192→7).
  • The 3 remaining violations are in Swift files (require Xcode to address).

Duplication: 7 → 5 clones, 102 → 65 lines

Extracted shared roundRect and distPointToSegment functions into a new web/src/games/canvas-utils.ts module, eliminating identical copies across motion-maker, slice, and reach-dodge.

Baseline updates

Metric Before After
Format files 19 0
Complexity violations 6 3
Complexity maxLength 189 180
Duplication clones 7 5
Duplication lines 102 65
Duplication % 0.8814 0.5543

Verification

Full quality gate (pnpm check) passes: format, lint, typecheck, test, build, landing, coverage, knip, complexity, duplication, cycles, dependencies, suppressions, hygiene.

- Fix all 19 TypeScript format violations (biome format)
- Extract routePose helper from server route() to reduce CCN 17→13
- Extract drawArm helper from drawSkeleton to reduce CCN 16→10
- Move hostFrom after Room class to fix lizard misparse (CCN 17→4, length 192→7)
- Extract shared roundRect + distPointToSegment into games/canvas-utils.ts
  to eliminate cross-game duplication
- Lower ratcheted baselines: format 19→0, complexity violations 6→3,
  maxLength 189→180, duplication clones 7→5, duplicatedLines 102→65,
  percentage 0.8814→0.5543

Closes #26
@sarthakagrawal927
sarthakagrawal927 force-pushed the fix/reduce-code-health-debt-26 branch from a25e707 to a262674 Compare August 15, 2026 12:18
@sarthakagrawal927
sarthakagrawal927 merged commit 67aa0b1 into main Aug 15, 2026
2 checks passed
@sarthakagrawal927
sarthakagrawal927 deleted the fix/reduce-code-health-debt-26 branch August 15, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce code-health baseline debt

1 participant