feat: Refactor cli.Main into ValidationRunner for easier reuse.#1145
Conversation
Per discussion in issue MobilityData#1135 and https://bit.ly/gtfs-validator-packaged-exe#heading=h.fcbgc2jy8dh, we'd like to refactor code in cli.Main into a new class that's easier to call from other contexts, including the new GUI-based app.
…e ValidationRunner return status. Use that info in the gui app to show the system_errors.json file when appropriate.
|
|
maximearmstrong
left a comment
There was a problem hiding this comment.
2 small things before approval. Otherwise, this is great. Thank you @bdferris-v2
app/gui/src/main/java/org/mobilitydata/gtfsvalidator/app/gui/Main.java
Outdated
Show resolved
Hide resolved
main/src/main/java/org/mobilitydata/gtfsvalidator/runner/ValidationRunner.java
Show resolved
Hide resolved
|
I addressed the suggested changes and test are now fully passing. I believe this is ready for a final review. |
|
We had to reconfigure the CLA wizard, so if possible, could you re-sign it with your second account? We will be ready to merge right after. |
|
I just resigned. Let me know if you need anything else? |
maximearmstrong
left a comment
There was a problem hiding this comment.
All good! Thank you @bdferris-v2
| */ | ||
| public static void printSummary(long startNanos, GtfsFeedContainer feedContainer) { | ||
| final long endNanos = System.nanoTime(); | ||
| if (!feedContainer.isParsedSuccessfully()) { |
There was a problem hiding this comment.
The Status codes put us in a good position to handle #1096 as well via something like Status.PARSING_FAILED, which is to surface the condition where parsing failed and many validators weren't invoked. That can be in a future PR.
Per discussion in issue #1135 and https://bit.ly/gtfs-validator-packaged-exe#heading=h.fcbgc2jy8dh, we'd like to refactor code in cli.Main into a new class that's easier to call from other contexts, including the new GUI-based app.
This PR moves the bulk of the code in
gtfsvalidator.cli.Maininto a newgtfsvalidator.runner.ValidationRunnerclass that does the work for setting up and running validation. The configuration for the run is passed via a new ValidationRunnerConfig class.Both
gtfsvalidator.cli.Mainandgtfsvalidator.app.gui.Mainhave been refactored to use this new validation runner. The gui app now uses the return code from the runner to potentially open system_errors.json when appropriate.Command-line argument parsing is left in the existing
Argumentsclass, which I've refactored to produce a config object as its primary output. I'll also merged in the logic fromgtfsvalidator/cli/CliParametersAnalyzer.java, since it made the interface forArgumentssimpler and I think conceptually it seems reasonable to include it there.