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


##########
superset/db_engine_specs/presto.py:
##########
@@ -498,7 +498,10 @@ def _partition_query(  # pylint: 
disable=too-many-arguments,too-many-locals,unus
         if filters:
             l = []  # noqa: E741
             for field, value in filters.items():
-                l.append(f"{field} = '{value}'")
+                # Escape single quotes so a ``'`` in the caller-supplied value
+                # cannot break out of the SQL string literal. See #41869.
+                escaped_value = str(value).replace("'", "''")

Review Comment:
   **Suggestion:** Add an explicit type annotation for this newly introduced 
local variable. [custom_rule]
   
   **Severity Level:** Minor ๐Ÿงน
   <details>
   <summary><b>Why it matters? โญ </b></summary>
   
   The new local variable is clearly a string value derived from `str(value)`, 
so it can be annotated as `str`. The custom rule requires type hints for newly 
added relevant variables that can be annotated, so this 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=40e6da74218449dd8ac1c219252e45aa&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=40e6da74218449dd8ac1c219252e45aa&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/db_engine_specs/presto.py
   **Line:** 503:503
   **Comment:**
        *Custom Rule: Add an explicit type annotation for this newly introduced 
local variable.
   
   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%2F41877&comment_hash=511eb4186672379a94bde5a7228ba9a76af4811a8c5b466f03400632a06e8098&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41877&comment_hash=511eb4186672379a94bde5a7228ba9a76af4811a8c5b466f03400632a06e8098&reaction=dislike'>๐Ÿ‘Ž</a>



##########
superset/db_engine_specs/presto.py:
##########
@@ -671,9 +674,9 @@ def latest_sub_partition(
             )
 
         part_fields = indexes[0]["column_names"]
-        for k in kwargs.keys():  # pylint: 
disable=consider-iterating-dictionary
-            if k not in k in part_fields:  # pylint: 
disable=comparison-with-itself
-                msg = f"Field [{k}] is not part of the portioning key"
+        for k in kwargs:
+            if k not in part_fields:
+                msg = f"Field [{k}] is not part of the partitioning key"

Review Comment:
   **Suggestion:** Add an explicit type annotation for this new error-message 
variable. [custom_rule]
   
   **Severity Level:** Minor ๐Ÿงน
   <details>
   <summary><b>Why it matters? โญ </b></summary>
   
   The variable is a newly introduced error message string and can be annotated 
as `str`. Since the rule requires type hints on relevant annotatable variables, 
this omission is a valid 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=b8dc8cb428214c7cb2df1977210c089a&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=b8dc8cb428214c7cb2df1977210c089a&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/db_engine_specs/presto.py
   **Line:** 679:679
   **Comment:**
        *Custom Rule: Add an explicit type annotation for this new 
error-message variable.
   
   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%2F41877&comment_hash=708c6bfdb0514a375b80c08a24fe3b9430b1b0928582d3a7c2a14cadcd4c97cf&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41877&comment_hash=708c6bfdb0514a375b80c08a24fe3b9430b1b0928582d3a7c2a14cadcd4c97cf&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