codeant-ai-for-open-source[bot] commented on code in PR #41996:
URL: https://github.com/apache/superset/pull/41996#discussion_r3570118088


##########
tests/unit_tests/core_tests.py:
##########
@@ -55,6 +56,10 @@
     "label": "My Adhoc Column",
     "sqlExpression": "case when foo = 1 then 'foo' else 'bar' end",
 }
+JINJA_HAVING = (
+    "sum(price_each) > {% if filter_values('threshold')|length %} "
+    "{{ filter_values('threshold')[0] }} {% else %} 0 {% endif %}"
+)

Review Comment:
   **Suggestion:** Add an explicit type annotation to this new module-level 
constant (for example, annotate it as a string). [custom_rule]
   
   **Severity Level:** Minor 🧹
   <details>
   <summary><b>Why it matters? ⭐ </b></summary>
   
   This is a newly added module-level constant assigned a string tuple 
expression without any type annotation, and the rule requires annotating 
relevant variables that can be typed.
   </details>
   <details>
   <summary><b>Rule source πŸ“– </b></summary>
   
   .cursor/rules/dev-standard.mdc (line 28)
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=0e9595df19904406b0000ca3858298f5&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=0e9595df19904406b0000ca3858298f5&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/core_tests.py
   **Line:** 59:62
   **Comment:**
        *Custom Rule: Add an explicit type annotation to this new module-level 
constant (for example, annotate it as a string).
   
   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%2F41996&comment_hash=88e61607ac0cdc02debe193a651917d67862a6a64e6c90cc5dcdd693a2996887&reaction=like'>πŸ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41996&comment_hash=88e61607ac0cdc02debe193a651917d67862a6a64e6c90cc5dcdd693a2996887&reaction=dislike'>πŸ‘Ž</a>



##########
tests/unit_tests/test_viz_query_obj.py:
##########
@@ -0,0 +1,57 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""
+Behavioral tests for ``viz.BaseViz.query_obj`` covering free-form filter
+clause handling.
+"""
+
+from typing import Any
+
+from superset import viz
+from superset.connectors.sqla.models import SqlaTable
+from superset.models.core import Database
+
+JINJA_HAVING = (
+    "sum(price_each) > {% if filter_values('threshold')|length %} "
+    "{{ filter_values('threshold')[0] }} {% else %} 0 {% endif %}"
+)
+
+
+def _viz(form_data: dict[str, Any]) -> viz.BaseViz:
+    database = Database(database_name="d", sqlalchemy_uri="sqlite://")
+    datasource = SqlaTable(
+        table_name="t",
+        columns=[],
+        metrics=[],
+        main_dttm_col=None,
+        database=database,
+    )
+    return viz.BaseViz(datasource=datasource, form_data=form_data)
+
+
+def test_query_obj_preserves_jinja_in_freeform_having():

Review Comment:
   **Suggestion:** Add an explicit return type annotation to this new test 
function to comply with the project’s Python type hint requirement. 
[custom_rule]
   
   **Severity Level:** Minor 🧹
   <details>
   <summary><b>Why it matters? ⭐ </b></summary>
   
   This is newly added Python code and the test function lacks an explicit 
return type annotation. Under the project rule requiring type hints on 
functions/methods that can be annotated, the missing `-> None` is a real 
violation.
   </details>
   <details>
   <summary><b>Rule source πŸ“– </b></summary>
   
   .cursor/rules/dev-standard.mdc (line 28)
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=bf2d53de732148328295b6ddb3bfeb87&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=bf2d53de732148328295b6ddb3bfeb87&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/test_viz_query_obj.py
   **Line:** 46:46
   **Comment:**
        *Custom Rule: Add an explicit return type annotation to this new test 
function to comply with the project’s Python 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%2F41996&comment_hash=398d4cf3594e914d8fc98b8d7bd0a9a900d85b0d428be165eb2e2c98f519f344&reaction=like'>πŸ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41996&comment_hash=398d4cf3594e914d8fc98b8d7bd0a9a900d85b0d428be165eb2e2c98f519f344&reaction=dislike'>πŸ‘Ž</a>



##########
tests/unit_tests/core_tests.py:
##########
@@ -233,3 +238,61 @@ def test_get_time_filter_status_no_temporal_col():
             }
         ],
     )
+
+
+def test_split_adhoc_filters_joins_sql_expressions():

Review Comment:
   **Suggestion:** Add a return type hint to this new test function signature. 
[custom_rule]
   
   **Severity Level:** Minor 🧹
   <details>
   <summary><b>Why it matters? ⭐ </b></summary>
   
   This new test function omits a return type annotation, which is a direct 
violation of the Python type-hint requirement for new or modified functions.
   </details>
   <details>
   <summary><b>Rule source πŸ“– </b></summary>
   
   .cursor/rules/dev-standard.mdc (line 28)
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=e30a3a10dd2d43b49dfb5cf4e5d20b5b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=e30a3a10dd2d43b49dfb5cf4e5d20b5b&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/core_tests.py
   **Line:** 243:243
   **Comment:**
        *Custom Rule: Add a return type hint to this new test function 
signature.
   
   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%2F41996&comment_hash=aac6995723ecdd70d159f022bcd2671a93cee0d1429b803c184e84f13dc2e430&reaction=like'>πŸ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41996&comment_hash=aac6995723ecdd70d159f022bcd2671a93cee0d1429b803c184e84f13dc2e430&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]

Reply via email to