Reduce cognitive complexity in history-overlay component
Resolved 💬 0 comments Opened Apr 19, 2025 by dchrty Closed Apr 21, 2025
Problem
The buildLists function in history-overlay.tsx has high cognitive complexity due to:
- Multiple nested conditionals for handling different types of commands
- Complex string manipulation and path extraction
- Mixed responsibilities (command processing, file extraction, text formatting)
- Limited test coverage for edge cases
Proposed Solution
Refactor the code to:
- Split the complex
buildListsfunction into smaller, focused helper functions - Improve test coverage with comprehensive test cases
- Maintain the same functionality while making the code more maintainable