Comfy-Org / Comfy-Org/ComfyUI_frontend

Large untested files: useBrushDrawing (1,597), coreSettings (1,194), ui.ts (717), pathRenderer (838)

Open
#11,033 0 comments 0 reactions 0 assignees View on GitHub
area:mask-editor area:testing audit:refactor code-audit developer experience
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Recommendation

### ♻️ REFACTOR: Break up large files and add test coverage

Four large files with mixed concerns and no test coverage.

## What Was Found

### useBrushDrawing.ts — 1,597 Lines
- `src/composables/maskeditor/useBrushDrawing.ts`
- Contains `gpuRender` (101 lines) and `drawEnd` (93 lines)
- Mixes GPU rendering, input handling, and brush state
- GPU rendering partially extracted to `GPUBrushRenderer.ts` — finish the extraction

### coreSettings.ts — 1,194 Lines
- `src/platform/settings/constants/coreSettings.ts`
- One giant array of 119 setting config objects interleaving callback functions
- Split by domain: `canvasSettings.ts`, `performanceSettings.ts`, `uiSettings.ts`

### ui.ts — 717 Lines
- `src/scripts/ui.ts:109`
- `dragElement` function is 132 lines of imperative DOM manipulation
- 9 consumers — extract into composable or use VueUse `useDraggable`

### pathRenderer.ts — 838 Lines
- `src/renderer/core/canvas/pathRenderer.ts`
- Complex bezier math mixed with rendering logic
- Magic numbers (`0.25`, `30`, `0.01`) — extract to named constants
- Bezier math utilities are independently testable

## Context

These files share a common pattern: large, untested, with extractable pure logic that would benefit from independent testing.

---

**Category:** Refactoring Opportunity | **Confidence:** MEDIUM | **Tools:** Static analysis (wc -l)
_Filed by audit-code skill_

Part of #11022

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11033-Large-untested-files-useBrushDrawing-1-597-coreSettings-1-194-ui-ts-717-pat-33e6d73d365081318742c97ce29e9974) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.