codeant-ai-for-open-source[bot] commented on code in PR #41979:
URL: https://github.com/apache/superset/pull/41979#discussion_r3574330954
##########
tests/unit_tests/db_engine_specs/test_sqlite.py:
##########
@@ -121,12 +121,13 @@ def test_time_grain_expressions(dttm: str, grain: str,
expected: str) -> None:
from superset.db_engine_specs.sqlite import SqliteEngineSpec
engine = create_engine("sqlite://")
- connection = engine.connect()
- connection.execute(text("CREATE TABLE t (dttm DATETIME)"))
- connection.execute(text("INSERT INTO t VALUES (:dttm)"), {"dttm": dttm})
+ with engine.begin() as connection:
+ connection.execute(text("CREATE TABLE t (dttm DATETIME)"))
+ connection.execute(text("INSERT INTO t VALUES (:dttm)"), {"dttm":
dttm})
# pylint: disable=protected-access
expression =
SqliteEngineSpec._time_grain_expressions[grain].format(col="dttm")
sql = f"SELECT {expression} FROM t" # noqa: S608
- result = connection.execute(text(sql)).scalar()
+ with engine.connect() as connection:
+ result = connection.execute(text(sql)).scalar()
Review Comment:
**Suggestion:** Add an explicit type annotation for this newly introduced
local value to satisfy the type-hint requirement for relevant variables.
[custom_rule]
**Severity Level:** Minor ๐งน
<details>
<summary><b>Why it matters? โญ </b></summary>
This is newly added Python code introducing a local variable without an
annotation, and the project rule requires type hints for relevant variables
that can be annotated. The variable `result` is a clear candidate for a type
hint, so the violation is real.
</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=e43473a4b326473099be2cae159804e0&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=e43473a4b326473099be2cae159804e0&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/db_engine_specs/test_sqlite.py
**Line:** 132:132
**Comment:**
*Custom Rule: Add an explicit type annotation for this newly introduced
local value to satisfy the type-hint requirement for relevant variables.
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%2F41979&comment_hash=6c9ed7952a9c905582dfbdc4036a9d0046639f51d554280d1c8c0ee120bb0c05&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41979&comment_hash=6c9ed7952a9c905582dfbdc4036a9d0046639f51d554280d1c8c0ee120bb0c05&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]