codeant-ai-for-open-source[bot] commented on code in PR #41301: URL: https://github.com/apache/superset/pull/41301#discussion_r3456312740
########## tests/unit_tests/utils/version_test.py: ########## @@ -0,0 +1,50 @@ +# 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. +"""Tests for superset.utils.version helpers.""" + +from superset.utils.version import visible_version_metadata + + +def _metadata(): Review Comment: **Suggestion:** Add an explicit return type annotation to this helper function so the newly added code is fully typed. [custom_rule] **Severity Level:** Minor ⚠️ <details> <summary><b>Why it matters? 🤔 </b></summary> The file is newly added Python code, and this helper function has no type hints for its return value. That matches the rule requiring newly added Python functions to be fully typed. </details> [](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=6615a705884841c1b91b1c903e04ade3&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=6615a705884841c1b91b1c903e04ade3&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/utils/version_test.py **Line:** 22:22 **Comment:** *Custom Rule: Add an explicit return type annotation to this helper function so the newly added code is fully typed. 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%2F41301&comment_hash=8fd59c1c52e4237f3d6075d3867a72ca756721ef82fe85c0f0c3ac4fddfc834a&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41301&comment_hash=8fd59c1c52e4237f3d6075d3867a72ca756721ef82fe85c0f0c3ac4fddfc834a&reaction=dislike'>👎</a> ########## tests/unit_tests/utils/version_test.py: ########## @@ -0,0 +1,50 @@ +# 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. +"""Tests for superset.utils.version helpers.""" + +from superset.utils.version import visible_version_metadata + + +def _metadata(): + return { + "version_string": "4.0.0", + "version_sha": "abcdef12", + "build_number": "build-42", + } + + +def test_visible_version_metadata_hides_build_details_when_not_exposed(): + """Build details are blanked while the release version string is kept.""" + result = visible_version_metadata(_metadata(), expose_build_details=False) + assert result["version_string"] == "4.0.0" + assert result["version_sha"] == "" + assert result["build_number"] is None + + +def test_visible_version_metadata_keeps_build_details_when_exposed(): Review Comment: **Suggestion:** Add a `-> None` return annotation to this new test function so the added code includes complete type hints. [custom_rule] **Severity Level:** Minor ⚠️ <details> <summary><b>Why it matters? 🤔 </b></summary> This newly added test function has no return type annotation, which violates the rule that new Python functions should be fully typed. </details> [](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=7433389d2e944092926650e85b865774&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=7433389d2e944092926650e85b865774&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/utils/version_test.py **Line:** 38:38 **Comment:** *Custom Rule: Add a `-> None` return annotation to this new test function so the added code includes complete type hints. 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%2F41301&comment_hash=956c3cafdc7b967af8da67c506fcc561b5f38449a59e2224100a2594d190c189&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41301&comment_hash=956c3cafdc7b967af8da67c506fcc561b5f38449a59e2224100a2594d190c189&reaction=dislike'>👎</a> ########## tests/unit_tests/utils/version_test.py: ########## @@ -0,0 +1,50 @@ +# 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. +"""Tests for superset.utils.version helpers.""" + +from superset.utils.version import visible_version_metadata + + +def _metadata(): + return { + "version_string": "4.0.0", + "version_sha": "abcdef12", + "build_number": "build-42", + } + + +def test_visible_version_metadata_hides_build_details_when_not_exposed(): Review Comment: **Suggestion:** Add a `-> None` return annotation to this new test function to satisfy full typing requirements for added Python functions. [custom_rule] **Severity Level:** Minor ⚠️ <details> <summary><b>Why it matters? 🤔 </b></summary> The function is newly added Python code and it lacks a return type annotation. That is a real violation of the full-typing rule for new functions. </details> [](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ca8d55e9c7a949948c18530985652170&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=ca8d55e9c7a949948c18530985652170&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/utils/version_test.py **Line:** 30:30 **Comment:** *Custom Rule: Add a `-> None` return annotation to this new test function to satisfy full typing requirements for added 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%2F41301&comment_hash=803ec4cf97b5a2a298de9362e8318bb12ddfa4b46cecc9fb2e08c9c6a0c7ab6c&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41301&comment_hash=803ec4cf97b5a2a298de9362e8318bb12ddfa4b46cecc9fb2e08c9c6a0c7ab6c&reaction=dislike'>👎</a> ########## tests/unit_tests/utils/version_test.py: ########## @@ -0,0 +1,50 @@ +# 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. +"""Tests for superset.utils.version helpers.""" + +from superset.utils.version import visible_version_metadata + + +def _metadata(): + return { + "version_string": "4.0.0", + "version_sha": "abcdef12", + "build_number": "build-42", + } + + +def test_visible_version_metadata_hides_build_details_when_not_exposed(): + """Build details are blanked while the release version string is kept.""" + result = visible_version_metadata(_metadata(), expose_build_details=False) + assert result["version_string"] == "4.0.0" + assert result["version_sha"] == "" + assert result["build_number"] is None + + +def test_visible_version_metadata_keeps_build_details_when_exposed(): + """All details pass through unchanged when exposure is allowed.""" + metadata = _metadata() + result = visible_version_metadata(metadata, expose_build_details=True) + assert result == metadata + + +def test_visible_version_metadata_does_not_mutate_input(): Review Comment: **Suggestion:** Add a `-> None` return annotation to this new test function to align with the rule requiring full typing in newly changed code. [custom_rule] **Severity Level:** Minor ⚠️ <details> <summary><b>Why it matters? 🤔 </b></summary> This newly introduced test function also lacks a return type annotation, so it fits the typing rule violation. </details> [](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=81d4e38cb7124fc7917e815130960ad1&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=81d4e38cb7124fc7917e815130960ad1&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/utils/version_test.py **Line:** 45:45 **Comment:** *Custom Rule: Add a `-> None` return annotation to this new test function to align with the rule requiring full typing in newly changed code. 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%2F41301&comment_hash=756c3d62344d00b9f34d409c950985017d41f0d07bdf27884acf83a87717bb0c&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41301&comment_hash=756c3d62344d00b9f34d409c950985017d41f0d07bdf27884acf83a87717bb0c&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]
