bito-code-review[bot] commented on code in PR #38651:
URL: https://github.com/apache/superset/pull/38651#discussion_r2935511313


##########
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:
   <!-- Bito Reply -->
   The suggestion enhances license validation in pyproject.toml by handling 
dict-formatted licenses, extracting 'file' or 'text' for string comparison. 
This supports string-based licenses as intended, with file-based licenses noted 
for future extension.json updates.
   
   **superset-extensions-cli/src/superset_extensions_cli/cli.py**
   ```
   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})"
               )
   ```



-- 
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