codeant-ai-for-open-source[bot] commented on code in PR #35542: URL: https://github.com/apache/superset/pull/35542#discussion_r3408398852
########## superset/migrations/versions/2025-10-06_16-05_b54f3bd8e69_update_tag_unique_constraint.py: ########## @@ -0,0 +1,116 @@ +# 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. +"""update_tag_unique_constraint + +Revision ID: b54f3bd8e69 +Revises: c233f5365c9e +Create Date: 2025-10-06 16:05:00.000000 + +""" + +import enum + +import migration_utils as utils +from alembic import op +from sqlalchemy import Column, Enum, Integer, MetaData, String, Table, Text +from sqlalchemy.sql import func, select + +# revision identifiers, used by Alembic. +revision = "b54f3bd8e69" +down_revision = "c233f5365c9e" + + +class TagType(enum.Enum): + # pylint: disable=invalid-name + custom = 1 + type = 2 + owner = 3 + favorited_by = 4 + + +# Define the tag table structure for data operations +metadata = MetaData() +tag_table = Table( + "tag", + metadata, + Column("id", Integer, primary_key=True), + Column("name", String(250)), + Column("type", Enum(TagType)), + Column("description", Text), +) + +old_constraint_name = "tag_name_key" +new_constraint_name = "uix_tag_name_type" +table_name = "tag" +new_constraint_columns = ["name", "type"] + + +def upgrade(): Review Comment: **Suggestion:** Add an explicit return type annotation to this new migration function (for example, annotate it as returning no value). [custom_rule] **Severity Level:** Minor ⚠️ <details> <summary><b>Why it matters? 🤔 </b></summary> The rule requires newly added Python functions to be fully typed, including return annotations. This new migration function has no return type hint, so the suggestion correctly identifies a real violation. </details> [Fix in Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=7a309866bd7a4a299bd19861612f3f82&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=7a309866bd7a4a299bd19861612f3f82&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/migrations/versions/2025-10-06_16-05_b54f3bd8e69_update_tag_unique_constraint.py **Line:** 62:62 **Comment:** *Custom Rule: Add an explicit return type annotation to this new migration function (for example, annotate it as returning no value). 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%2F35542&comment_hash=5f60404d6b6d9f8c030370cfb6dd2891762c7aee3b151454fe1560a3a4618eae&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F35542&comment_hash=5f60404d6b6d9f8c030370cfb6dd2891762c7aee3b151454fe1560a3a4618eae&reaction=dislike'>👎</a> ########## superset/migrations/versions/2025-10-06_16-05_b54f3bd8e69_update_tag_unique_constraint.py: ########## @@ -0,0 +1,116 @@ +# 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. +"""update_tag_unique_constraint + +Revision ID: b54f3bd8e69 +Revises: c233f5365c9e +Create Date: 2025-10-06 16:05:00.000000 + +""" + +import enum + +import migration_utils as utils +from alembic import op +from sqlalchemy import Column, Enum, Integer, MetaData, String, Table, Text +from sqlalchemy.sql import func, select + +# revision identifiers, used by Alembic. +revision = "b54f3bd8e69" +down_revision = "c233f5365c9e" + + +class TagType(enum.Enum): + # pylint: disable=invalid-name + custom = 1 + type = 2 + owner = 3 + favorited_by = 4 Review Comment: **Suggestion:** Add an inline class docstring describing the purpose of this new enum class. [custom_rule] **Severity Level:** Minor ⚠️ <details> <summary><b>Why it matters? 🤔 </b></summary> The rule requires newly added classes to include docstrings. This enum class does not have a docstring immediately under the class definition, so the suggestion is a real rule violation. </details> [Fix in Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=13d367610daf458da34f6b1ebafeb367&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=13d367610daf458da34f6b1ebafeb367&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/migrations/versions/2025-10-06_16-05_b54f3bd8e69_update_tag_unique_constraint.py **Line:** 37:42 **Comment:** *Custom Rule: Add an inline class docstring describing the purpose of this new enum 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%2F35542&comment_hash=1fafe40b840d48d179b93478b63b1f5880478ad8595715a98c2bd5c1ccf76032&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F35542&comment_hash=1fafe40b840d48d179b93478b63b1f5880478ad8595715a98c2bd5c1ccf76032&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]
