refactor(shared): extract escape_rich_markup to shared/rich_utils.py#752
Conversation
Extract the duplicated _escape_rich_markup function from history_side_panel.py and richlog_visualizer.py into a new shared/rich_utils.py module. This eliminates code duplication by consolidating the Rich markup escaping utility that was previously defined in two separate TUI files with identical implementations. Addresses item from code quality report. Closes #751 Co-authored-by: openhands <openhands@all-hands.dev>
|
@OpenHands /iterate to green and approved by the AI reviewer from pr-review workflow. If approved, merge it and make sure you comment tagging me. |
|
I'm on it! enyst can track my progress at all-hands.dev |
Coverage Report •
|
|||||||||||||||||||||||||||||||||||||||||||||
Co-authored-by: openhands <openhands@all-hands.dev>
all-hands-bot
left a comment
There was a problem hiding this comment.
🟢 Good taste - Clean refactoring that eliminates code duplication by extracting escape_rich_markup to a shared module. The function logic is unchanged, tests are updated appropriately, and the new location is logical.
VERDICT: ✅ Worth merging - Textbook example of a DRY refactoring
[RISK ASSESSMENT]
- [Overall PR]
⚠️ Risk Assessment: 🟢 LOW
Pure refactoring with no behavior change. Function logic is identical, just moved to a shared location. Tests pass and cover the function thoroughly.
Was this automated review useful? React with 👍 or 👎 to this review to help us measure review quality.
Workflow run: https://github.com/OpenHands/OpenHands-CLI/actions/runs/26403061166
|
Since my last summary, there were no additional code or repository changes. Final status:
|
Summary
Extract the duplicated
_escape_rich_markupfunction fromhistory_side_panel.pyandrichlog_visualizer.pyinto a newshared/rich_utils.pymodule.Changes
openhands_cli/shared/rich_utils.pywith theescape_rich_markup()functionopenhands_cli/shared/__init__.pyto export the new function_escape_rich_markupfunction intui/panels/history_side_panel.pywith import from shared module_escape_rich_markupintui/widgets/richlog_visualizer.pywith import from shared moduletests/tui/widgets/test_richlog_visualizer.pyto use the shared functionRelated Issue
Addresses findings from #751
Testing
make lint)make test- 1353 tests)This PR was automatically generated by the Code Quality Report workflow.
🚀 Try this PR