Use the prompt
Include the callers as well as the duplicated code. Similar-looking blocks may handle different cases, and those differences matter when deciding what to combine.
Identify and consolidate duplicate code into reusable components. Apply DRY principles systematically.
For GitLab Duo
I found duplicate code:
Location 1:
[PASTE CODE]
Location 2:
[PASTE CODE]
Help me:
1. Extract common logic
2. Create reusable function/class
3. Update all call sites
4. Ensure no functionality is lostInclude the callers as well as the duplicated code. Similar-looking blocks may handle different cases, and those differences matter when deciding what to combine.