codeant-ai-for-open-source[bot] commented on code in PR #34880:
URL: https://github.com/apache/superset/pull/34880#discussion_r3574904081
##########
superset/commands/dashboard/importers/v1/__init__.py:
##########
@@ -102,6 +128,10 @@ def _import(
if file_name.startswith("datasets/") and config["uuid"] in
dataset_uuids:
database_uuids.add(config["database_uuid"])
+ # assets inside dashboard databases, datasets and charts
+ # should be overwritten only if both flags are set to True
+ overwrite_assets = overwrite and kwargs.get("overwrite_all", False)
Review Comment:
**Suggestion:** Add a boolean type annotation to this newly introduced local
variable that controls overwrite behavior. [custom_rule]
**Severity Level:** Minor ๐งน
<details>
<summary><b>Why it matters? โญ </b></summary>
This newly introduced local variable is a boolean control flag and is
currently unannotated. It can be explicitly typed as bool, so the suggestion
accurately identifies a real type-hint omission.
</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=9c4a00cc0c664a09905d968a21156896&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=9c4a00cc0c664a09905d968a21156896&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:** superset/commands/dashboard/importers/v1/__init__.py
**Line:** 133:133
**Comment:**
*Custom Rule: Add a boolean type annotation to this newly introduced
local variable that controls overwrite behavior.
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%2F34880&comment_hash=4b2168e4d82dd78e03deddb472d0e95c69a6017114b18f3f8dc1d222d8be1f7d&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F34880&comment_hash=4b2168e4d82dd78e03deddb472d0e95c69a6017114b18f3f8dc1d222d8be1f7d&reaction=dislike'>๐</a>
##########
superset/commands/dashboard/importers/v1/__init__.py:
##########
@@ -67,6 +68,30 @@ class ImportDashboardsCommand(ImportModelsCommand):
}
import_error = DashboardImportError
+ def __init__(self, contents: dict[str, str], *args: Any, **kwargs: Any) ->
None:
+ self.overwrite_all = kwargs.pop("overwrite_all", False)
Review Comment:
**Suggestion:** Add an explicit boolean type annotation for the new instance
attribute assigned from `kwargs` in the constructor. [custom_rule]
**Severity Level:** Minor ๐งน
<details>
<summary><b>Why it matters? โญ </b></summary>
This new instance attribute is assigned without any explicit type
annotation, and it can clearly be annotated as a boolean. That matches the
Python type-hint rule violation described in the suggestion.
</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=32756f8b52a2492da25c88f0994426ea&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=32756f8b52a2492da25c88f0994426ea&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:** superset/commands/dashboard/importers/v1/__init__.py
**Line:** 72:72
**Comment:**
*Custom Rule: Add an explicit boolean type annotation for the new
instance attribute assigned from `kwargs` in the constructor.
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%2F34880&comment_hash=c59b1d23d59d3b12bb3059d236f03911de2e55465a2e5226c2de0910fff96be9&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F34880&comment_hash=c59b1d23d59d3b12bb3059d236f03911de2e55465a2e5226c2de0910fff96be9&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]