-
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: introduce -p CLI parameter to output beautified reports #901
Conversation
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.
Thanks for working on this!
@@ -36,6 +36,8 @@ | |||
public class NoticeContainer { | |||
private static final Gson DEFAULT_GSON = | |||
new GsonBuilder().serializeNulls().serializeSpecialFloatingPointValues().create(); | |||
private static final Gson PRETTY_GSON = |
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.
We risk to have those Gson objects out of sync. Let's try this:
private static final Gson PRETTY_GSON = new GsonBuilder(DEFAULT_GSON).setPrettyPrinting().create();
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.
Unfortunately the constructor GsonBuilder(Gson gson)
is package-private and cannot be accessed from NoticeContainer
class. What do you think of the following?
private static final Gson PRETTY_GSON = DEFAULT_GSON.newBuilder().setPrettyPrinting().create();
https://www.javadoc.io/doc/com.google.code.gson/gson/2.8.5/com/google/gson/Gson.html#newBuilder--
core/src/main/java/org/mobilitydata/gtfsvalidator/notice/NoticeContainer.java
Outdated
Show resolved
Hide resolved
main/src/main/java/org/mobilitydata/gtfsvalidator/cli/Arguments.java
Outdated
Show resolved
Hide resolved
main/src/test/java/org/mobilitydata/gtfsvalidator/cli/ArgumentsTest.java
Outdated
Show resolved
Hide resolved
- remove new additional unit tests - sync Gson builders
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.
Good job! But please move the static functions back to their previous location.
core/src/main/java/org/mobilitydata/gtfsvalidator/notice/NoticeContainer.java
Outdated
Show resolved
Hide resolved
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.
Very good, thank you!
closes #838
Summary:
This PR provides support for an additional CLI parameter :
-p
/--pretty
which takes no value. This is used to bautfy the generated reports.Expected behavior:
Sample usage
report.json
system_errors.json
Please make sure these boxes are checked before submitting your pull request - thanks!
gradle test
to make sure you didn't break anything