-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Refactor cli.Main into ValidationRunner for easier reuse. #1145
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.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good! Thank you @bdferris-v2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.Main
into a newgtfsvalidator.runner.ValidationRunner
class 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.Main
andgtfsvalidator.app.gui.Main
have 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
Arguments
class, 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 forArguments
simpler and I think conceptually it seems reasonable to include it there.