codeant-ai-for-open-source[bot] commented on code in PR #41127:
URL: https://github.com/apache/superset/pull/41127#discussion_r3578633760
##########
tests/unit_tests/sql/execution/conftest.py:
##########
@@ -94,6 +94,10 @@ def mock_database() -> MagicMock:
database.db_engine_spec.get_cancel_query_id = MagicMock(return_value=None)
database.db_engine_spec.patch = MagicMock()
database.db_engine_spec.fetch_data = MagicMock(return_value=[])
+ # Mirrors the real `Database.mutate_sql_based_on_config` default (no-op
+ # when no `SQL_QUERY_MUTATOR` is configured), so SQL parsed from its
+ # return value stays valid instead of an un-parseable `MagicMock`.
+ database.mutate_sql_based_on_config = MagicMock(side_effect=lambda sql,
**kw: sql)
Review Comment:
**Suggestion:** Replace the inline untyped lambda with a small typed helper
function (e.g., annotate SQL input and return type) and use that helper as the
side effect. [custom_rule]
**Severity Level:** Minor ๐งน
<details>
<summary><b>Why it matters? โญ </b></summary>
The new lambda is an untyped function added in modified Python code. Under
the type-hints rule, a callable that can be annotated should not be introduced
without explicit type hints, so this is a real violation.
</details>
<details>
<summary><b>Rule source ๐ </b></summary>
.cursor/rules/dev-standard.mdc (line 28)
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=2754de2af4034be289a54ec68e75d1d1&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=2754de2af4034be289a54ec68e75d1d1&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** tests/unit_tests/sql/execution/conftest.py
**Line:** 100:100
**Comment:**
*Custom Rule: Replace the inline untyped lambda with a small typed
helper function (e.g., annotate SQL input and return type) and use that helper
as the side effect.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41127&comment_hash=2d0b1b6b3f934372746bb2dbe4ad471b55dbe00c244ff805558b4b7bae751645&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41127&comment_hash=2d0b1b6b3f934372746bb2dbe4ad471b55dbe00c244ff805558b4b7bae751645&reaction=dislike'>๐</a>
--
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]