codeant-ai-for-open-source[bot] commented on code in PR #38584:
URL: https://github.com/apache/superset/pull/38584#discussion_r3454803786
##########
tests/integration_tests/charts/commands_tests.py:
##########
@@ -668,6 +713,43 @@ def test_update_chart_dashboard_security_admin_bypass(
db.session.delete(alpha_dashboard)
db.session.commit()
+ @patch("superset.commands.chart.update.g")
+ @patch("superset.utils.core.g")
+ @patch("superset.security.manager.g")
+ @pytest.mark.usefixtures("load_energy_table_with_slice")
+ def test_update_chart_rejects_new_externally_managed_dashboard(
+ self, mock_sm_g, mock_u_g, mock_c_g
+ ):
Review Comment:
**Suggestion:** Add complete type annotations to this newly added test
method signature and include an explicit `-> None` return type. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This newly added test method also omits parameter type hints and does not
declare a
return type. Since it is new Python code in the changed region, the typing
rule applies
and the suggestion identifies a real violation.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ac12bffb5add4c25a124ee4a768e30c6&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=ac12bffb5add4c25a124ee4a768e30c6&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/charts/commands_tests.py
**Line:** 720:722
**Comment:**
*Custom Rule: Add complete type annotations to this newly added test
method signature and include an explicit `-> None` return type.
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%2F38584&comment_hash=4c5bef55ef6a714dfe1278973cf63beffab134f58be3df8952bf6c4ee09d3948&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38584&comment_hash=4c5bef55ef6a714dfe1278973cf63beffab134f58be3df8952bf6c4ee09d3948&reaction=dislike'>👎</a>
##########
tests/integration_tests/charts/commands_tests.py:
##########
@@ -393,6 +394,50 @@ def test_create_v1_response(self, mock_sm_g, mock_c_g,
mock_u_g):
db.session.delete(chart)
db.session.commit()
+ @patch("superset.utils.core.g")
+ @patch("superset.commands.chart.create.g")
+ @patch("superset.security.manager.g")
+ @pytest.mark.usefixtures("load_energy_table_with_slice")
+ def test_create_chart_rejects_externally_managed_dashboard(
+ self, mock_sm_g, mock_c_g, mock_u_g
+ ):
Review Comment:
**Suggestion:** Add full type hints to this new test method signature,
including the patched mock parameters and an explicit `-> None` return type.
[custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This is a newly added Python test method and it has no type annotations for
its parameters
or an explicit `-> None` return type. That matches the custom rule requiring
new Python
functions/methods to be fully typed.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=82f543dbf8fa4d0c8e937587fbf22513&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=82f543dbf8fa4d0c8e937587fbf22513&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/charts/commands_tests.py
**Line:** 401:403
**Comment:**
*Custom Rule: Add full type hints to this new test method signature,
including the patched mock parameters and an explicit `-> None` return type.
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%2F38584&comment_hash=fbf12946de2acf27596094ef1a0703b24f406fd9991085f06c5cac610b9695b1&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38584&comment_hash=fbf12946de2acf27596094ef1a0703b24f406fd9991085f06c5cac610b9695b1&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]