bito-code-review[bot] commented on code in PR #38651:
URL: https://github.com/apache/superset/pull/38651#discussion_r2935491558
##########
superset-extensions-cli/src/superset_extensions_cli/cli.py:
##########
@@ -372,12 +375,167 @@ def validate() -> None:
click.secho(" Convention requires: frontend/src/index.tsx",
fg="yellow")
sys.exit(1)
+ # Validate version and license consistency across extension.json,
frontend, and backend
+ mismatches: list[str] = []
+ frontend_pkg_path = cwd / "frontend" / "package.json"
+ frontend_pkg = None
+ if frontend_pkg_path.is_file():
+ frontend_pkg = read_json(frontend_pkg_path)
+ if frontend_pkg:
+ if frontend_pkg.get("version") != extension.version:
+ mismatches.append(
+ f" frontend/package.json version:
{frontend_pkg.get('version')} "
+ f"(expected {extension.version})"
+ )
+ if extension.license and frontend_pkg.get("license") !=
extension.license:
+ mismatches.append(
+ f" frontend/package.json license:
{frontend_pkg.get('license')} "
+ f"(expected {extension.license})"
+ )
+
+ backend_pyproject_path = cwd / "backend" / "pyproject.toml"
+ if backend_pyproject_path.is_file():
+ backend_pyproject = read_toml(backend_pyproject_path)
+ if backend_pyproject:
+ project = backend_pyproject.get("project", {})
+ if project.get("version") != extension.version:
+ mismatches.append(
+ f" backend/pyproject.toml version:
{project.get('version')} "
+ f"(expected {extension.version})"
+ )
+ if extension.license and project.get("license") !=
extension.license:
+ mismatches.append(
+ f" backend/pyproject.toml license:
{project.get('license')} "
+ f"(expected {extension.license})"
+ )
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>License comparison bug in validation</b></div>
<div id="fix">
The license comparison for backend pyproject.toml may fail incorrectly
because pyproject.toml license can be a dict (e.g., {file="LICENSE.txt"}) while
extension.license is a string. This causes false mismatch reports. Consider
normalizing license values or handling dict formats properly.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
````suggestion
license_in_project = project.get("license")
if isinstance(license_in_project, dict):
license_in_project = license_in_project.get("file") or
license_in_project.get("text")
if extension.license and license_in_project != extension.license:
mismatches.append(
f" backend/pyproject.toml license: {license_in_project} "
f"(expected {extension.license})"
)
````
</div>
</details>
</div>
<small><i>Code Review Run #3abf02</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]