refactor(cli): reduce cognitive complexity in setup.ts #453
Reference in New Issue
Block a user
Delete Branch "fix/445-reduce-setup-complexity"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Refactored
setup.tsincli-workflowto reduce cognitive complexity by extracting inline logic into focused helper functions.Why
The setup command contained deeply nested conditional logic that exceeded the maximum allowed cognitive complexity of 15, making it hard to read, test, and maintain.
Changes
setup-complexity.test.tsto verify the refactored helpersRef
Fixes #445
LGTM ✅ 重构质量好,测试覆盖全面。
⚠️ Minor
ValidationResult类型中error建议改为error?: string | null以匹配原始类型。不阻塞。