-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Feature Request
Description of Problem:
Description: The current PythonCodeGeneratorCLI exits immediately (System.exit(1)) upon encountering any validation errors, and ignores warnings. This rigid behavior prevents users from inspecting partially correct models or enforcing stricter quality control (e.g., treating warnings as errors).
We need to enhance the CLI with fine-grained control over the generation process and add unit tests to ensure robustness.
Potential Solutions:
-
Refactor CLI for Testability: PythonCodeGeneratorCLI to expose a method (e.g., calculateExitCode(String[] args)) that returns an integer status code instead of directly calling System.exit(). This allows unit tests to invoke the CLI logic without terminating the JVM.main method will simply delegate to this new method and pass the result to System.exit().
-
Add Control Flags:
--allow-errors (-e): Continue generation even if validation errors occur. Useful for debugging or partial generation.
--fail-on-warnings (-w): Treat validation warnings as errors. Useful for strict CI/CD pipelines.
Add CLI Unit Tests: -
Create a new test class PythonCodeGeneratorCLITest.java.
Test scenarios:
-- Successful generation (exit code 0).
-- Validation error -> Fail (exit code 1).
-- Validation error + --allow-errors -> Success (exit code 0).
-- Warning -> Success (exit code 0).
-- Warning + --fail-on-warnings -> Fail (exit code 1).
Acceptance Criteria:
-- CLI accepts -e and -w flags and behaves as documented.
-- Unit tests cover all major execution paths and flag combinations.
-- No regression in existing CLI functionality.