bito-code-review[bot] commented on code in PR #40980:
URL: https://github.com/apache/superset/pull/40980#discussion_r3399501329
##########
superset/reports/filters.py:
##########
@@ -25,6 +25,14 @@
from superset.views.base import BaseFilter
+def _escape_like(value: str) -> str:
+ """
+ Escape LIKE/ILIKE wildcard characters so user-supplied search text is
matched
+ literally instead of being interpreted as wildcards (e.g. ``%`` and ``_``).
+ """
+ return value.replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_")
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Duplicate function across modules</b></div>
<div id="fix">
The `_escape_like` function is duplicated identically in
`superset/daos/base.py:84`. Maintaining two identical copies creates
maintenance risk: future changes must be applied in both locations or the
codebase will become inconsistent.
</div>
</div>
<small><i>Code Review Run #d65847</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]