codeant-ai-for-open-source[bot] commented on code in PR #40955:
URL: https://github.com/apache/superset/pull/40955#discussion_r3408034219
##########
superset/commands/chart/exceptions.py:
##########
@@ -103,6 +103,19 @@ def __init__(self) -> None:
)
+class ChartQueryContextDatasourceMismatchValidationError(ValidationError):
+ """
+ Raised when a query-context-only update carries a datasource that does not
+ match the chart's own datasource.
+ """
+
+ def __init__(self) -> None:
+ super().__init__(
+ _("The query context datasource does not match the chart
datasource"),
+ field_name="query_context",
+ )
Review Comment:
**Suggestion:** Add an inline docstring to the newly added initializer
method so the new function is documented consistently with the rule for new
Python functions. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This is a newly added Python method, and it has no docstring. The custom
rule requires new Python functions and classes to be documented inline, so the
suggestion identifies a real violation.
</details>
[Fix in
Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=858260d1e2e64c3db5a7557f5e6db588&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
| [Fix in VSCode
Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=858260d1e2e64c3db5a7557f5e6db588&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/chart/exceptions.py
**Line:** 112:116
**Comment:**
*Custom Rule: Add an inline docstring to the newly added initializer
method so the new function is documented consistently with the rule for new
Python functions.
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%2F40955&comment_hash=7a235e0f15a3a4d8a7703c888e9c7b9a1c96a607304026e4eecb1fe62fc303c8&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40955&comment_hash=7a235e0f15a3a4d8a7703c888e9c7b9a1c96a607304026e4eecb1fe62fc303c8&reaction=dislike'>👎</a>
##########
tests/unit_tests/commands/chart/update_test.py:
##########
@@ -151,3 +152,76 @@ def test_update_chart_owner_can_perform_regular_update(
find_by_id.assert_called_once_with(1)
raise_for_ownership.assert_called_once()
+
+
+def _query_context_payload(datasource: object) -> dict[str, object]:
+ return {
+ "query_context": json.dumps({"datasource": datasource, "queries": []}),
+ "query_context_generation": True,
+ }
Review Comment:
**Suggestion:** Add an inline docstring to this newly added helper function
describing that it builds a query-context update payload for tests.
[custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This is a newly added Python function in the PR and it has no docstring. The
custom rule requires newly added functions and classes to be documented inline,
so the suggestion correctly identifies a real violation.
</details>
[Fix in
Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=90a7d669f73144c4a9fea2e87ad560db&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
| [Fix in VSCode
Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=90a7d669f73144c4a9fea2e87ad560db&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/commands/chart/update_test.py
**Line:** 157:161
**Comment:**
*Custom Rule: Add an inline docstring to this newly added helper
function describing that it builds a query-context update payload for tests.
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%2F40955&comment_hash=25a94fb6ccbf437891e845517c020f7745fa12865c9746a06b9c1547b717cf46&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40955&comment_hash=25a94fb6ccbf437891e845517c020f7745fa12865c9746a06b9c1547b717cf46&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]