codeant-ai-for-open-source[bot] commented on code in PR #40129: URL: https://github.com/apache/superset/pull/40129#discussion_r3350425153
########## superset/commands/chart/restore.py: ########## @@ -0,0 +1,43 @@ +# 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. +"""Command to restore a soft-deleted chart.""" + +import logging + +from superset.commands.chart.exceptions import ( + ChartForbiddenError, + ChartNotFoundError, + ChartRestoreFailedError, +) +from superset.commands.restore import BaseRestoreCommand +from superset.daos.chart import ChartDAO +from superset.models.slice import Slice + +logger = logging.getLogger(__name__) Review Comment: **Suggestion:** `logging` and `logger` are introduced but never used, which adds dead code and an unnecessary module import. Remove the unused logger setup (or add actual logging calls) to keep the command minimal and avoid lint/runtime overhead from unused symbols. [code quality] <details> <summary><b>Severity Level:</b> Minor ๐งน</summary> ```mdx - โ ๏ธ Linting step reports unused import and variable. - โ ๏ธ Adds minor noise in reviews for this command. ``` </details> <details> <summary><b>Steps of Reproduction โ </b></summary> ```mdx 1. Open `superset/commands/chart/restore.py` and observe at line 19 the import `import logging` (verified via Read tool output) and at line 30 the assignment `logger = logging.getLogger(__name__)`. 2. In the same file, inspect the `RestoreChartCommand` class definition at lines 33โ43 and confirm there are no references to `logging` or `logger` anywhere in the file (no `logger.` calls or use of the imported module). 3. Run any standard Python linter used in this repository (e.g., pyflakes/ruff/flake8) over `superset/commands/chart/restore.py`; because `logging` is imported but never used and `logger` is assigned but never referenced, the linter will report unused-import and unused-variable warnings for these symbols. 4. Observe that these warnings originate specifically from `superset/commands/chart/restore.py:19` (`import logging`) and `superset/commands/chart/restore.py:30` (`logger = logging.getLogger(__name__)`), confirming that the logger setup is dead code until actual logging calls are added. ``` </details> [Fix in Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=9531404a77df46c8b9574e896dc30009&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=9531404a77df46c8b9574e896dc30009&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/restore.py **Line:** 19:30 **Comment:** *Code Quality: `logging` and `logger` are introduced but never used, which adds dead code and an unnecessary module import. Remove the unused logger setup (or add actual logging calls) to keep the command minimal and avoid lint/runtime overhead from unused symbols. 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%2F40129&comment_hash=e8e4996278c93a0e1f848d6701220314dff4ba088cbe4b5eb9254406ec755d0f&reaction=like'>๐</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40129&comment_hash=e8e4996278c93a0e1f848d6701220314dff4ba088cbe4b5eb9254406ec755d0f&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]
