codeant-ai-for-open-source[bot] commented on code in PR #41424:
URL: https://github.com/apache/superset/pull/41424#discussion_r3492552286
##########
superset/reports/notifications/email.py:
##########
@@ -205,9 +205,13 @@ def _get_content(self) -> EmailContent:
</html>
"""
)
- csv_data = None
+ # CSV and Excel are mutually exclusive (a report has a single format),
+ # so at most one tabular attachment is present in the data dict.
+ attachment_data = None
Review Comment:
**Suggestion:** Add an explicit type annotation for this newly introduced
local variable to satisfy the type-hint requirement. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This new local variable is introduced without a type hint, and its type is
readily inferable as an optional dict of attachment names to bytes. That
matches the custom rule requiring type hints on relevant variables that can be
annotated.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=31bf1551e43444ca90e5de83823bd862&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=31bf1551e43444ca90e5de83823bd862&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/reports/notifications/email.py
**Line:** 210:210
**Comment:**
*Custom Rule: Add an explicit type annotation for this newly introduced
local variable to satisfy the type-hint requirement.
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%2F41424&comment_hash=b0a29f80f734a5aab8f66d8dc9661b4c5127aa4092129f0a8aacdbf8ef1e315c&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41424&comment_hash=b0a29f80f734a5aab8f66d8dc9661b4c5127aa4092129f0a8aacdbf8ef1e315c&reaction=dislike'>👎</a>
##########
tests/integration_tests/reports/utils.py:
##########
@@ -42,6 +42,9 @@
TEST_ID = str(uuid4())
CSV_FILE = read_fixture("trends.csv")
+# Reports fetch tabular data as opaque bytes from the (mocked) chart export
+# endpoint, so any distinct non-empty payload is sufficient for Excel tests.
+XLSX_FILE = b"PK\x03\x04 mock xlsx bytes"
Review Comment:
**Suggestion:** Add an explicit type annotation for the new XLSX payload
constant so the newly introduced variable is fully typed. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
The new module-level constant is clearly a bytes value and can be annotated
as `bytes`, but it is left untyped. This matches the rule for newly added
Python variables that can be annotated.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=8c72fb754fae47148d6aa834db262a50&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=8c72fb754fae47148d6aa834db262a50&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/integration_tests/reports/utils.py
**Line:** 47:47
**Comment:**
*Custom Rule: Add an explicit type annotation for the new XLSX payload
constant so the newly introduced variable is fully typed.
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%2F41424&comment_hash=33e226125ebe468274f1bac766de1fa813bfc75a8ecec9132c2db3c6b211d842&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41424&comment_hash=33e226125ebe468274f1bac766de1fa813bfc75a8ecec9132c2db3c6b211d842&reaction=dislike'>👎</a>
##########
superset/commands/report/exceptions.py:
##########
@@ -296,6 +302,13 @@ class ReportScheduleCsvTimeout(CommandException):
message = _("A timeout occurred while generating a csv.")
+class ReportScheduleXlsxTimeout(CommandException):
+ """Raised when generating the Excel (xlsx) attachment for a report times
out."""
+
+ status = 408
+ message = _("A timeout occurred while generating an Excel file.")
Review Comment:
**Suggestion:** Add an explicit type annotation to the class-level `status`
attribute in this new exception class. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This new class-level integer attribute is added without a type annotation,
and the custom rule requires type hints on new or modified Python variables
that can be annotated. The violation is real.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=e27bbbe776014b0db3afcc86c56c3fe5&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=e27bbbe776014b0db3afcc86c56c3fe5&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/report/exceptions.py
**Line:** 305:309
**Comment:**
*Custom Rule: Add an explicit type annotation to the class-level
`status` attribute in this new exception class.
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%2F41424&comment_hash=cbecaf09743cea2bb2efe2e0acee5a247431e943159b682584dfc5f7e6e29f7d&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41424&comment_hash=cbecaf09743cea2bb2efe2e0acee5a247431e943159b682584dfc5f7e6e29f7d&reaction=dislike'>👎</a>
##########
superset/commands/report/execute.py:
##########
@@ -717,6 +748,7 @@ def _get_notification_content(self) -> NotificationContent:
# noqa: C901
:raises: ReportScheduleScreenshotFailedError
"""
csv_data = None
+ xlsx_data = None
Review Comment:
**Suggestion:** Add an explicit type annotation for this newly introduced
local variable to satisfy the type-hint requirement for relevant variables.
[custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
The new local variable is introduced without a type annotation even though
its type is clear and it is part of modified Python code. This matches the rule
requiring type hints for relevant variables that can be annotated.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=b1f02d9570f248ff8d334f60c1ee1fe2&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=b1f02d9570f248ff8d334f60c1ee1fe2&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/report/execute.py
**Line:** 751:751
**Comment:**
*Custom Rule: Add an explicit type annotation for this newly introduced
local variable 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%2F41424&comment_hash=871b607f3ff22353c95539707039164b66fcabca76bd57783a86c9510985a7f2&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41424&comment_hash=871b607f3ff22353c95539707039164b66fcabca76bd57783a86c9510985a7f2&reaction=dislike'>👎</a>
##########
tests/unit_tests/reports/notifications/webhook_tests.py:
##########
@@ -171,6 +171,37 @@ def
test_get_files_includes_all_content_types(mock_header_data) -> None:
assert mime_types.count("image/png") == 2
+def test_get_files_includes_xlsx(mock_header_data: HeaderDataType) -> None:
+ """_get_files attaches xlsx bytes as report.xlsx with the spreadsheet MIME
type."""
Review Comment:
**Suggestion:** Add an explicit type annotation to the new local variable so
the newly introduced test code fully complies with the required type-hinting
rule. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
The new local variable is introduced without a type annotation, and it can
clearly be annotated as `bytes`. This matches the rule requiring type hints for
new or modified Python code where applicable.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=02e73bd81203466b94485a93096d9f3f&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=02e73bd81203466b94485a93096d9f3f&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/reports/notifications/webhook_tests.py
**Line:** 175:175
**Comment:**
*Custom Rule: Add an explicit type annotation to the new local variable
so the newly introduced test code fully complies with the required type-hinting
rule.
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%2F41424&comment_hash=10b2a409ac61b3f56cc0d71ac407823c5cf97f2ea7393a42857dc4ce72a1069c&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41424&comment_hash=10b2a409ac61b3f56cc0d71ac407823c5cf97f2ea7393a42857dc4ce72a1069c&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]